WAIT(1)

NAME
wait - wait for a set of children, then execute a program

SYNOPSIS
In an execlineb(1) script:

wait [-I | -i] [-a | -o] [-r | -t timeout] { [pids...] } prog...

DESCRIPTION
wait reads a list of pids in a (possibly empty) block ( cf. execline-block(7)), and unquotes it.

wait waits for every child whose pid is listed in pids.... If pids... is an empty list, it waits for every child process it has.

wait then exec(3) s into prog....

For POSIX compatibility[1], wait also works when it cannot find a block. In that case, all the options are still supported and have the same effect, but the rest of the command line is interpreted as pids... arguments and wait does not execute into a program; instead, it exits with a conforming exit code.

OPTIONS

-r  Equivalent to ‘-t 0’. Do not pause: only reap processes that are already dead when wait is invoked.

-t timeout
    Wait for a maximum of timeout milliseconds. If there still are living processes among pids... (or among wait' s children if pids... is an empty list), after timeout milliseconds, they will not be reaped.

-I  Loose. If wait times out while waiting for children to die, it will still exec(3) into prog.... This is the default.

-i  Strict. If wait times out, it will print an error message and exit 99.

-o  Wait for one of the listed pids - exec(3) into prog as soon as one of the listed children dies. ( If no pid is listed, wait for one child to die.) The! environment variable will be set to the pid that died, and the? environment variable will contain an approximation of its exit code - refer to execline-exitcodes(7). If no listed child has died before wait has to exec(3) ( either because it timed out or it has no suitable children left), the? and! environment variables are unset.

-a  Wait for all of the listed pids. Do not touch the! or? variables. This is the default.

SEE ALSO
emptyenv(1), envfile(1), exec(1), execline-cd(1), execline-umask(1), execlineb(1), exit(1), export(1), fdblock(1), fdclose(1), fdmove(1), fdreserve(1), fdswap(1), getcwd(1), getpid(1), heredoc(1), piperw(1), posix-cd(1), posix-umask(1), redirfd(1), trap(1), tryexec(1), unexport(1), withstdinas(1), exec(3), execline-block(7)

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/wait.html

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/wait.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)