[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 6

wait Command


Waits until the termination of a process ID.


waitProcessID ... ]


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.


ProcessID Specifies an unsigned decimal integer process ID of a command, which the wait command waits on until termination.

Exit Status

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:

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.


/usr/bin/wait Contains the wait command.

Related Information

The shutdown command, sleep command, wall command.

The alarm subroutine, pause subroutine, sigaction subroutine.

Shells Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]