Suppose that I have three (or more) bash scripts: script1.sh
, script2.sh
, and script3.sh
. I would like to call all three of these scripts and run them in parallel. One way to do this is to just execute the following commands:
nohup bash script1.sh &
nohup bash script2.sh &
nohup bash script3.sh &
(In general, the scripts may take several hours or days to finish, so I would like to use nohup
so that they continue running even if my console closes.)
But, is there any way to execute those three commands in parallel with a single call?
I was thinking something like
nohup bash script{1..3}.sh &
but this appears to execute script1.sh
, script2.sh
, and script3.sh
in sequence, not in parallel.
nohup bash script{1..100}.sh &
orfor i in {1..100}; do nohup bash script{1..100} &; done
), rather than typingnohup bash script*.sh &
100 different times.screen
, too (ortmux
), in order to solve the console problem but keep access to the output (and input).nohup ... & nohup ... & nohup ... &
. If you mean instead that you want to run all of the scripts without typing each script name individually, a simple loop will do it.