1

我有一份我想并行运行的作业列表,我从一个主脚本中调用它们。这是一个例子

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"

我该怎么做呢?

4

1 回答 1

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"
于 2013-03-23T00:07:03.153 回答