Waits until the termination of a process ID.
wait [ ProcessID ... ]
The wait command waits (pauses execution) until the process ID specified by the ProcessID variable terminates. If the ProcessID variable is not specified, the wait command waits until all process IDs known to the invoking shell have terminated and exit with a 0 exit status. If a ProcessID variable represents an unknown process ID, the wait command treats them as known process IDs that exited with exit status 127. The wait command exits with the exitstatus of the last process ID specified by the ProcessID variable.
Item | Description |
---|---|
ProcessID | Specifies an unsigned decimal integer process ID of a command, which the wait command waits on until termination. |
If one or more operands were specified, all of the operands terminated or were not known by the invoking shell, and the status of the last operand specified is known, then the exit status of the wait command is the same as the exit status information of the command indicated by the last operand specified. If the process terminated abnormally due to the receipt of a signal, then the exit status is greater than 128 and distinct from the exit status information generated by other signals, although the exact status value is unspecified (see the kill -l command option). Otherwise, the wait command exits with one of the following values:
Item | Description |
---|---|
0 | The wait command was invoked with no operands and all process IDs known by the invoking shell have terminated. |
1-126 | The wait command detected an error. |
127 | The command identified by the last ProcessID operand specified is unknown. |
Item | Description |
---|---|
/usr/bin/wait | Contains the wait command. |