0

I have 5 python programs and i want to run them all simultaneously./concurrently

lets say i have these programs

python1.py
python2.py
python3.py
python4.py
python5.py

How can a shell script run them all together? if i just put 5 commands like this

all.sh
 python python1.py
 python python2.py
 python python3.py
 python python4.py
 python python5.py

will they work all together?

Is there any better alternative?

1 Answer 1

5

You can do this:

python python1.py &
python python2.py &
python python3.py &
python python4.py &
python python5.py &

wait # this will wait for all of them to finish
Sign up to request clarification or add additional context in comments.

3 Comments

great. what does the & symbol do?
Starts a job in the background.
just to make sure: all of them will run in a parallel way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.