我有一个bash脚本,其中其他几个程序都是用nohup启动的(都有相同的可执行文件,但参数不同),例如:
nohup ./code --p0 &
nohup ./code --p1 &
nohup ./code --p2 &
是否可以在nohup调用之后编写一个while循环,当所有./code
运行完成后终止?
您似乎正在寻找wait
:
nohup ./code --p0 &
nohup ./code --p1 &
nohup ./code --p2 &
wait # This would wait for all currently active child processes
echo "This statement would be printed after all nohup calls are finished executing"