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?

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.