Manual pages › General commands (1)
wait(1)
await completion of process
From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.
Also by this name: wait(2), System calls · wait(3B), BSD C library
NAME
wait - await completion of process
SYNOPSIS
wait [ n ]
DESCRIPTION
Wait for your background process whose process id is n and report its termination status. If n is omitted, all your shell's currently active background processes are waited for and the return code will be zero.
The shell itself executes wait, without creating a new process.
SEE ALSO
sh(1).
NOTES
If you get the error message cannot fork, too many processes, try using the wait command to clean up your background processes. If this doesn't help, the system process table is probably full or you have too many active foreground processes. (There is a limit to the number of process ids associated with your login, and to the number the system can keep track of.)
Not all the processes of a 3- or more-stage pipeline are children of the shell, and thus cannot be waited for.
If n is not an active process id, all your shell's currently active background processes are waited for and the return code will be zero.