我有一个bash脚本,其中几个其他程序是以nohup启动的(所有程序都有相同的可执行文件,但参数不同),例如:
nohup ./code --p0 &
nohup ./code --p1 &
nohup ./code --p2 &
是否可以在nohups调用之后编写while循环,在所有./code
运行完成后终止?
答案 0 :(得分:1)
您似乎在寻找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"