我有一个我希望并行运行的作业列表,我从一个主脚本中调用它们。这是一个例子
echo "Starting jobs"
job1 &
job2 &
job3 &
# I want to wait until job1, job2 & job3 finishes on the multi core box
echo "Now I can proceed"
我该怎么做?
答案 0 :(得分:4)
wait
是命令。执行将不会等到作业完成后再等待。
echo "Starting jobs"
job1 &
job2 &
job3 &
wait
# I want to wait until job1, job2 & job3 finishes on the multi core box
echo "Now I can proceed"