*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: wait | Section: 1 | Source: Digital UNIX | File: wait.1.gz
wait(1) General Commands Manual wait(1) NAME wait - Awaits process completion SYNOPSIS wait [pid] Note The C shell has a built-in version of the wait command. If you are us- ing the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/wait. See the csh(1) reference page for a description of the built-in command. STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: wait: XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. OPTIONS None OPERANDS One of the following: The unsigned decimal integer process ID of a com- mand, for which the utility is to wait for the termination. A job con- trol job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invocations of wait in the current shell execution environment. The exit status of wait is determined by the last command in the pipeline. DESCRIPTION When an asynchronous list is started by the shell, the process ID of the last command in each element of the asynchronous list becomes known in the current shell execution environment. If the wait utility is invoked with no operands, it waits until all process IDs known to the invoking shell have terminated and exits with a zero exit status. If one or more pid operands are specified that represent known process IDs, the wait utility waits until all of them have terminated. If one or more pid operands are specified that represent unknown process IDs, wait treats them as if they were known process IDs that exited with exit status 127. The exit status returned by the wait utility is the exit status of the process requested by the last pid operand. The known process IDs are applicable only for invocations of wait in the current shell execution environment. RESTRICTIONS If wait is called in a subshell or separate utility execution environ- ment, such as one of the following, it returns immediately because there are no known process IDs to wait for in those environments: (wait) nohup wait ... find . -exec wait ... \; If the exit sta- tus of wait is greater than 128, there is no way for the appli- cation to know if the waited-for process exited with that value or was killed by a signal. Since most utilities exit with small values, there is seldom any ambiguity. EXIT STATUS If one or more parameters were specified, all of them have terminated or were not known by the invoking shell, and the status of the last pa- rameter specified is known, then the exit status of wait is the exit status information of the command indicated by the last parameter spec- ified. If the process terminated abnormally due to the receipt of a signal, the exit status is greater than 128 and is distinct from the exit status generated by other signals. (See the kill -l option.) Oth- erwise, the wait utility exits with one of the following values: The wait utility was invoked with no operands and all process IDs known by the invoking shell have terminated. The wait utility detected an er- ror. The command identified by the last pid operand specified is un- known. EXAMPLES Although the exact value used when a process is terminated by a signal is unspecified, if it is known that a signal terminated a process, a script can still reliably figure out which signal using kill as shown by the following script: sleep 1000& pid=$! kill -kill $pid wait $pid echo $pid was ter- minated by a SIG$(kill -l $?) signal. If either sequence of commands shown on the first two lines is run in less than 31 seconds either of the commands shown on lines 3 and 4 will re- turn the exit status of the second sleep in the pipeline: sleep 257 | sleep 31 & jobs -l %% wait <pid of sleep 31> wait %% ENVIRONMENT VARIABLES The following environment variables affect the execution of wait: Pro- vides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, over- rides the values of all the other internationalization variables. De- termines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi- byte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to standard er- ror. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO Commands: bg(1), csh(1), fg(1), jobs(1), kill(1), ksh(1), sh(1) Functions: wait(2) Standards: standards(5) wait(1)

Navigation Options