我有一个过程
"verifyEmail"
I run this in script as verifyEmail 0 1000
现在,在继续执行shell脚本中的下一条指令之前,我该如何等待此过程执行完毕?验证电子邮件运行需要60多分钟
我试过
while ! checkprocess "verifyEmail"; do ##Checkprocess is a function which returns 0 or 1
sleep 60 ## based on process present or not
done
答案 0 :(得分:2)
如果您正常运行该过程,则无需执行任何操作。如果以异步方式运行它,则只需wait
即可:
verifyEmail 0 1000
echo This will print after verifyEmail is done!
或
verifyEmail 0 1000 &
wait $!
echo This will print after verifyEmail is done!