0

I have the following shell script

#for i in {0..10}
do
  run my command that takes about 10 seconds with parameter $i
done

How can I get this to run the commands in parallel without using GNU Parallel as I am not able to install it on my linux box.

Is there a way I can create 10 different shell scripts and call them e.g. script_1.sh, script_2.sh, script_3.sh etc and then launch them one by one from this script?

Harry Boy
  • 4,159
  • 17
  • 71
  • 122
  • Can you elaborate on if the reason why you cannot install GNU Parallel is covered by http://oletange.blogspot.dk/2013/04/why-not-install-gnu-parallel.html – Ole Tange Feb 08 '16 at 23:23

1 Answers1

3

You could use an ampersand (&) and launch script.sh $1 & ten times. This will make the script run in a fork of the main process. It is an easy way to do parallel processing but definitely not very flexible and doesn't have many features. A simple tutorial can be found here.

alpha1554
  • 605
  • 5
  • 15