Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


wait command (waits for child processes to complete)

Organization of this page

Format

wait  [pid ...]

Description

This command waits for child processes to complete. Specify for pid one or more process IDs of child processes waiting for completion. If pid is not specified, the command waits for all child processes being executed to complete. If an invalid process ID that begins with a non-numeric value is specified for pid, processing terminates normally with return code 127.

Note the following if a mixture of numeric values and non-numeric values is specified beginning with a numeric value, as shown in the example below: The character string up to the last position preceding the non-numeric value is interpreted as a process ID and the command waits for the child process to complete.

UAP &        # Shell variable ! stores the process that started the UAP.
wait $!ABC   # The wait command interprets the character string preceding ABC and waits for the child process to complete.

When the pid argument is specified, the wait command terminates with the return code of the last process that waited for completion. An example follows:

UAP1 &                    # UAP1 terminates with a return code of 2.
PID1=$!                   #
UAP2 &                    # UAP2 terminates with a return code of 16.
PID2=$!                   #
UAP3 &                    # UAP3 terminates with a return code of 0.
PID3=$!                   #
wait $PID1 $PID2 $PID3    # The wait command terminates with a return code of 0.

Argument

pid

Specifies the process ID of a child process that is waiting to complete.

Return codes

Return code

Meaning

0

Normal termination

127

Normal termination

  • Could not identify a specified child process.

  • A specified process ID was not for a currently executing child process.

Other than the above

Error termination

Notes

Usage example