我有5个python程序,我想同时运行它们./concurrently
让我说我有这些程序
python1.py
python2.py
python3.py
python4.py
python5.py
shell脚本如何一起运行它们?如果我只是输入5个这样的命令
all.sh
python python1.py
python python2.py
python python3.py
python python4.py
python python5.py
他们会一起工作吗?
还有更好的选择吗?
答案 0 :(得分: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