繁体   English   中英

在Shell脚本中无限循环同时运行多个程序

[英]Running multiple programs together in the shell script in infinite while loop

我有这样的shell脚本;

while true
do
     python get_proxies.py
     python run1.py & python run2.py & python run3.py & python run4.py &
     ......
done

在此循环中,我希望一起运行此类程序,但在所有程序完成处理之前,我不希望脚本传递到下一个循环。

我该如何处理?

谢谢,

使用内置的wait 因此,甚至不需要循环:

python run1.py & python run2.py & python run3.py & python run4.py &
wait

它将等待上述命令完成

我通常使用xterm

xterm -e "sh -c 'python myscript.py'"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM