This question already has answers here:
How to run a process with a timeout in Bash? [duplicate]
(2 answers)
How do I pause my shell script for a second before continuing?
(10 answers)
Closed 5 years ago.
I am new to shell scripting, and would like to know how to call the second script 5 seconds after running the first script. In the example below, I would like ./csv3xlsx_osx to run 5 seconds after the python script completes.
python script.py
./csv2xlsx_osx -infile input.csv -outfile ouptut.xlsx
How would one go about doing the equivalent of Javascript's setTimeout() in shell?
Related
This question already has answers here:
Brace expansion with variable? [duplicate]
(6 answers)
how to use variables with brace expansion [duplicate]
(2 answers)
Closed 2 years ago.
I have the following in my bash file:
echo "Spawning $1 processes"
for i in {1..$1}
do
(go run loadgen.go $2 &)
echo "done."
done
However, I can only seem to get my go file to execute once. I know that they're started in the background, but each of my go files should append to the same log file (I can reproduce this by running my bash script multiple times). Am I doing something wrong to get this to iterate multiple times?
This question already has answers here:
How do I run a shell script without using "sh" or "bash" commands?
(13 answers)
How to enable a system-wide function for users including sudo?
(2 answers)
Closed 3 years ago.
I have a bash script called climb.sh. When I execute it I write
./climb.sh 1
while inside the directory in which the script is located. However, I want to do the same thing wherever I am, and across all shell sessions by simply calling
climb 1
Also, climb.sh takes an numeric argument and calls "cd ../" that many times. In order for the program to work, it has to run alongside the current process, not within some child process.
How to achieve all this?
Thanks
This question already has answers here:
How do I parse command line arguments in Bash?
(40 answers)
How to get exact command line string from shell?
(2 answers)
Closed 3 years ago.
Suppose my script.sh could take a number of options and arguments. What is the best way to find out what the script was invoked with (form inside the script)?
For eg., someone called it with script.sh --foo_option bar_arg
Is there a way to echo that exact command they typed from inside the script?
I've tried echo !! which does not work inside a script.
This question already has answers here:
Why do you need to put #!/bin/bash at the beginning of a script file?
(10 answers)
What is the preferred Bash shebang ("#!")?
(6 answers)
Closed 4 years ago.
What is the significant of using #!/bin/bash in the starting of bash script? Can we write a bash script without #!/bin/bash ?
This line is called shebang. It’s a ‚magic‘ line telling the program loader (kernel) how to execute a script on unixoid systems.
Cf. https://en.m.wikipedia.org/wiki/Shebang_(Unix)
This question already has answers here:
Writing a Bash script without the shebang line
(2 answers)
Bash script execution with and without shebang in Linux and BSD
(2 answers)
Closed 5 years ago.
If after logging into my system I type: bash (to use bash subshell) and then try to run a bash script (e.g. example.sh), then does it matter if I do not put #!/bin/bash as the first line of the script or it is fine since I am already inside bash subshell?