wait

等待每个指定的进程完成并返回其终止状态

语法

  wait [n ...]

选项

n   进程ID或作业规范

每个n可以是流程ID或作业规范;如果给定了作业规范,则等待该作业管道中的所有进程。

如果未给出n,则等待所有当前活动的子进程,并且返回状态为零。

如果n指定不存在的进程或作业,则返回状态为127.否则,返回状态是最后一个进程或作业等待的退出状态。

wait是一个内置命令的bash。

例子

$ wait 2585

wait 命令实例:

linux命令:wait wait waitrootopen.com
linux命令:wait wait waitrootopen.com
2018-02-27 03:58:48

linux命令:wait $! $! wait wait $!rootopen.com
linux命令:wait $! $! wait wait $!rootopen.com
2018-03-15 09:04:48

linux命令:wait 536; anywait 536; anywaitd 537; anywaitp 5562 5563 5564 5564 5563 5562 anywaitp 537; anywaitd 536; anywait 536; wait wait 536; anywait 536; anywaitd 537; anywaitp 5562 5563 5564rootopen.com
linux命令:wait 536; anywait 536; anywaitd 537; anywaitp 5562 5563 5564 5564 5563 5562 anywaitp 537; anywaitd 536; anywait 536; wait wait 536; anywait 536; anywaitd 537; anywaitp 5562 5563 5564rootopen.com
2018-06-06 17:03:48

linux命令:wait_for_this.sh; echo "wait_for_this.sh finished running" | mail -s "Job Status Update" username@gmail.com username@gmail.com Update" Status "Job -s mail | running" finished "wait_for_this.sh echo wait_for_this.sh; wait_for_this.sh; echo "wait_for_this.sh finished running" | mail -s "Job Status Update" username@gmail.comrootopen.com
linux命令:wait_for_this.sh; echo "wait_for_this.sh finished running" | mail -s "Job Status Update" username@gmail.com username@gmail.com Update" Status "Job -s mail | running" finished "wait_for_this.sh echo wait_for_this.sh; wait_for_this.sh; echo "wait_for_this.sh finished running" | mail -s "Job Status Update" username@gmail.comrootopen.com
2018-02-23 03:40:48

linux命令:wait_for_this.sh; echo "wait_for_this.sh finished running with status $?" | mail -s "Job Status Update" username@gmail.com username@gmail.com Update" Status "Job -s mail | $?" status with running finished "wait_for_this.sh echo wait_for_this.sh; wait_for_this.sh; echo "wait_for_this.sh finished running with status $?" | mail -s "Job Status Update" username@gmail.comrootopen.com
linux命令:wait_for_this.sh; echo "wait_for_this.sh finished running with status $?" | mail -s "Job Status Update" username@gmail.com username@gmail.com Update" Status "Job -s mail | $?" status with running finished "wait_for_this.sh echo wait_for_this.sh; wait_for_this.sh; echo "wait_for_this.sh finished running with status $?" | mail -s "Job Status Update" username@gmail.comrootopen.com
2018-03-16 17:03:48

Linux的Bash命令行(A-Z排序)