通过shell脚本一起运行5个python程序

use*_*370 0 python bash shell ubuntu

我有5个python程序,我想同时运行它们./concurrently

让我说我有这些程序

python1.py
python2.py
python3.py
python4.py
python5.py
Run Code Online (Sandbox Code Playgroud)

shell脚本如何一起运行它们?如果我只是输入5个这样的命令

all.sh
 python python1.py
 python python2.py
 python python3.py
 python python4.py
 python python5.py
Run Code Online (Sandbox Code Playgroud)

他们会一起工作吗?

还有更好的选择吗?

Joh*_*nck 5

你可以这样做:

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
Run Code Online (Sandbox Code Playgroud)