Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [scripts]

A script is a series of instructions written in a "plain text" file. The script interpreter (for example, Bash or another shell, Python, Perl, Ruby, etc.) reads the file and carries out the instructions as if they had been entered at the command prompt.

0
votes
0answers
12 views

Syntax error installation script

Why does this script give me a syntax error running ubuntu 18.04? #!/bin/sh # Copyright (c) 2011 Altera Corporation. All rights reserved. # Your use of Altera Corporation's design tools, logic ...
0
votes
1answer
23 views

mysqldump script doesn't work in cron

I've been going through all the various questions about why a specific script run in cron and nothing has helped me thus far. So I'm just trying to run a mysqldump script that now looks like this: #!/...
0
votes
1answer
25 views

Script for permissions

Novice user here. I have created an environment where there are three users, Tim, James and Harry. I have created a group called Friends, which includes Tim and James. I have changed the permissions ...
0
votes
0answers
30 views

Need to delete a junk file created while running a shell script

I have a shell script test.sh. Within that I am trying to execute another shell script abc.sh. When abc.sh is executed it takes in one of the options a,b,c. If I choose "a " and press enter, it ...
2
votes
1answer
38 views

Delete all but newest file of format 08-20-2018_01:24-PM

I use this to make it easier to see when a backup script ran. touch /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/$( date '+%m-%d-%Y_%I:%M-%p' ) I would like a script that would delete all but the ...
0
votes
1answer
54 views

How to automatically kill a process using script? [duplicate]

How to write a script that kills a java process? From console it looks like root@ubuntu-s-1vcpu-1gb-ams3-01:~# lsof -i tcp:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 9657 ...
1
vote
1answer
29 views

Why cron not executing script?

I create a simply script in /root/test.sh file: #!/bin/bash echo "hello" mkdir newdir next: chmod +x /root/test.sh We can convinced, what test.sh is owned by root: root@ubuntu-s-1vcpu-1gb-ams3-01:...
0
votes
2answers
34 views

How to get the real path of a sh file that is being sourced

I added this line into my ~/.bashrc . /mnt/c/Users/enzo/drive/projects/dotfiles/init.sh And and inside of init.sh I am trying to get the path of init.sh but I am not able to. I tried this so far: ...
1
vote
1answer
62 views

Need help to copy the contents of the temp file created by another shell script within a shell script

I have a shell script test.sh. Within that I am trying to execute another shell script abc.sh. When abc.sh is executed it takes in one of the options a,b,c. If I choose a and press enter, it creates ...
2
votes
1answer
16 views

for loop find how to recursive directories and whitespaces [duplicate]

I am trying to write a script to check video file codec (using ffprobe), and encode them accordingly (with HandBrakeCLI). Directory mp4 >> Sub-Directory >> mp4 >> >> Sub-sub ...
0
votes
0answers
36 views

File creation using an app on server initiated with SSH command running via bash script

I have an app on my server which creates log files when running. I have to run this application from my local machine using a script. So in my script I use SSH command to execute my app on the server. ...
1
vote
1answer
23 views

Start a server using a shell script

Now, I need to start the server like this. $./server.start I have to this every time I start and logged into my machine. It would be so good if there is a script which does the same automatically ...
-1
votes
1answer
37 views

after su, the script stops working

we are running script the the first command in it is su (switch user) and after that other command: #!/bin/bash su sys_osrqa whoami pwd but when the script run, it asks for password, and after we ...
0
votes
1answer
36 views

Determine if a shell script is running on a LiveOS/chroot/installed system?

How can I determine within a shell script if the script is running: On a Ubuntu LiveOS (not necessarily version dependant) -- (already answered here) Within a chroot on an Ubuntu LiveOS (already ...
-3
votes
0answers
42 views

Variable not working [duplicate]

I can not understand why this does not change into the directory upon exit of the script. DOCS="/home/andy/Documents" SCRIPTS="/home/andy/bin/" ICONS="/home/andy/ICONS" DESKTOP="/home/andy/Desktop/" ...
0
votes
2answers
30 views

Jenkins list user ids using script console

I want to list all users in jenkins, via the console script that jenkins has. So far i managed to list all the users using this: import hudson.model.User User.getAll().each { user -> println ...
0
votes
0answers
11 views

HPC job submission: difference betwee a binary and a script

I am trying to submit a job on an HPC and I am very new to the GSE submission system. Upon submitting a job using a script called script1.bash, I received the following error file. Warning: no ...
0
votes
0answers
33 views

Scripting Netplan for static IP address

I've posted in the forum but thought I would ask here also. So, I am new to Ubuntu Server 18.04, netplan and .yaml. In the past using Ubuntu Server 16.04 I was able to create a pretty decent shell ...
0
votes
0answers
25 views

Install with .sh files [closed]

I made .sh file that installs all the apps and themes I want to for when I move to a new computer. Can I have it install pictures and text files to a certain location when ran?
0
votes
0answers
24 views

command not found error on qiime 1

using qiime 1, upon typing this command make_distance_histogram.py, I got an error saying command not found how can I solve this problem? appreciate your help, thanks
1
vote
1answer
26 views

ping multiple IP's from mysql using bash?

How can I ping a list of IPs found in a mysql database from bash? I have a table called nics containing these fields: id user_id machine_id mac ipv4 ipv6 dns icmp => used as a binary (0=disable, 1=...
0
votes
1answer
81 views

Run script no more than twice a day WITHOUT using cron

Can a script be run no more than twice a day WITHOUT using cron ? 8/12/2018 5:46 p.m. @Ravexina This is my script using Ravexina recommendation. SCRIPT=$(realpath "$0") V=$(pstree -sp $$ | grep "($...
2
votes
1answer
16 views

Using bash in combination with psql, passing variable between them

I'm writing a bash script where I use psql (Postgresql). DATABASE='scifi' sudo -u postgres psql count=SELECT COUNT(*) FROM (SELECT datname FROM pg_catalog.pg_database WHERE lower(datname)=lower($...
0
votes
1answer
16 views

How to handle signal in foreground process?

I have doubt, why does we cannot use kill -s 9 <pid> or kill -s 15 <pid> to kill foreground process? When I am trying to do the same, getting result that process id does not exist ...
2
votes
1answer
64 views

How can I make a bash script display its output like `man`, not filling up the terminal?

For example - run man in a terminal. I don't know how they did that - but it runs in a way that it doesn't output everything into the terminal - when you press q it goes away, and goes back to the ...
1
vote
1answer
58 views

How to convert script command output into plain text

I am using script-command to save the output of terminal to file. but, it gives some extra characters like square-like characters and other text encrypted characters. man script command tells, by ...
0
votes
1answer
54 views

When I try to run a run.sh file, it says another .sh file is not found. How do I solve this?

Hey so I have downloaded this (clicking on this hyperlink downloads) http://cs-people.bu.edu/sameki/LabelMe.zip into ubuntu via command line, and I go to the folder to find a run.sh to run. But when I ...
0
votes
1answer
105 views

Increment numbers in a string

I've been looking for a way to increment numbers in a long string of mine : run("Bio-Formats", "open=/Users/m-a/Desktop/test_stabilite001.nd2 color_mode=Default rois_import=[ROI manager] ...
0
votes
1answer
25 views

Using EOF for Templating a bash script

I am attempting to create a simple script which will generate files in /etc/apache2/sites-available directory using a for loop, and get it to do this using a template within my script. This is what ...
1
vote
1answer
26 views

In a bash script how do I pass a variable integer to a 'sed -e' command (18.04)

I'm trying to create a bash script that trashes the oldest files in a directory with a variable setting the amount of files to retain. My first step was to count the number of files older than a set ...
1
vote
0answers
26 views

“logger” differences betw script and command line

If I enter from the command line logger "This is a test" in my syslog I get: Aug 9 07:54:22 computername root: This is a test but if I use the exact same line in a script, when the script is run, ...
0
votes
1answer
37 views

spark-submit not found in bash

I have a cronjob to run a script at startup, which i created using crontab -e @reboot /home/ubuntu/startup.sh > /home/ubuntu/log.log 2>&1 My startup.sh script contains: #!/bin/bash ... ...
2
votes
1answer
29 views

Formatting chage command date output

I wanted a script to visually warn users on my system that their password is about to expire. I found this one here. The thing is, the author of that script gets the number of days to password ...
0
votes
2answers
38 views

How do I show the terminal after a script is executed at startup?

I'm executing a bash script through a custom created service. At user login, the script is executed. I can verify that the program is running with the ps -ef command. The only thing I want to have ...
0
votes
1answer
24 views

Running script at shutdown and reboot to prevent Chromium session loss

I'm running Ubuntu 18.04.1 and I'm trying to create a script that shuts down Chromium properly before shutting down the system so that it doesn't give me "restore session" popup after booting. I ...
1
vote
1answer
44 views

How to install MK - a program “Holy Bible” [duplicate]

I am a fresh user of Ubuntu. I enjoy with 18.04 version and there are many things to learn. As for example to launch a program called "Holy Bible." The distributor is the "Institute for Bible ...
3
votes
2answers
56 views

read file content in for/while loop, removing escape characters

I'm trying to read the contents of a file, that have line separators as CRLF but I think that is not a problem, and also have a character \n at the end of each line and sometimes a \t between words, ...
1
vote
1answer
32 views

Script in /etc/rc3.d not start on boot

I have a problem with a script that have run on boot. I put this easy script in /etc/init.d #!/bin/bash ### BEGIN INIT INFO # Provides: start_app # Required-Start: # Required-Stop: # Default-...
1
vote
1answer
28 views

How can I start gnome-terminal at a particular directory and execute a command? [duplicate]

I am new to Linux and trying to use hotkey and terminal more often. At the moment I could use gnome-terminal --working-directory=university to open a particular directory in terminal per hotkey (...
0
votes
1answer
31 views

Calling .py script from .sh script error “ImportError: No module named apiclient.discovery”

I have a python script I wish to call each day with a cron job. Because the .py script loads several files from it's directory, rather than change all the file paths within the .py script to be full ...
0
votes
3answers
38 views

Is there a way to create a new directory, containing subdirectories and documents?

For web-development practice I'm using a LAMP stack, on Ubuntu 17.10. For this I'm creating directories within /var/www, each directory is named after a project. To create a subdirectory I use the ...
0
votes
1answer
40 views

mkdir command not working inside shell script

I have a shell script in one server (Ubuntu) say server1, in which i create a folder in other server say server2. But the command for create directory is not working. Folder is not creating in server2 ...
0
votes
0answers
26 views

Reliable safe way to copy multiple directories to backup folder? Linux Script [duplicate]

I have defined a list of folders I want my script to read from, for each folder in the list I want to copy all content to a backup folder I run cp -r /next_folder_inlist /to_backup , in a while loop ...
0
votes
0answers
13 views

KWin scripting - calling a DBus function with callDBus

So I'm trying to get started with scripting kwin - specifically, I want some minor modifications to the kwin tiling script. based on the kde docs, I started the desktop shell scripting console with ...
0
votes
1answer
33 views

udhcpc and VLAN settings on embedded systems

It is good idea use script for udhcpc linux busybox tool for configuring VLAN settings or purpose of this script is realted to dhcp protocol? From manual of udhcpc there is option to provide script ...
0
votes
0answers
12 views

Continusly run the Bash script on the Ubuntu Server as Process [duplicate]

I Have a SCP upload script which uploads the files on the remote host. I am trying to run this script as background process so it can be even work when I am not logged into session. I am trying to ...
2
votes
2answers
116 views

if else condition with Remote server directory Size

I am writing a small script to upload the files to remote ssh server and on the remote ssh server I will have almost 2 TB of Space available. I need to check within the shell script if the Space is ...
0
votes
1answer
37 views

Calling script in script in crontab -e. Failed

$ script-in-script.sh > /dev/shm/output.txt; works fine. But, if you put the above command line in script.sh and add * * * * * script.sh in crontab -e it doesn't work. /dev/shm/output.txt is ...
1
vote
1answer
40 views

How to uninstall app via source command?

I have installed a nautilus script called Hash Checker v4.0.8 (https://www.gnome-look.org/p/1007703/), but somehow it is not shown in the right-click menu anyway. It was placed on my Desktop and I can ...
0
votes
0answers
22 views

Shell Script Compares: Why double-quotes around variables? [duplicate]

I shell scripts I see compares always written this way: if [ "$?" -eq 0 ] then ... What the purpose of the double-quotes around the variable? If I remove the quotes then it doesn't seem to have an ...