wait

wait for process to complete 

KornShell Built-in


SYNOPSIS

wait [pid|job-id...]


DESCRIPTION

wait waits for the termination of one or more jobs or child processes in the background. If you specify job-ids, wait waits for all processes in each job to terminate. If you specify a pid, wait waits for the child process with that process ID to terminate. If no child process has that process ID, wait returns immediately.

If you specify neither a pid nor a job-id, wait waits for the termination of all process IDs known to the invoking shell.


DIAGNOSTICS

If you specified a job-id which has terminated or is unknown by the invoking shell, an error message and a return code of 127 is returned. If you specified a pid which has terminated or is unknown to the shell, a return code of 127 is returned. If a signal terminated the process abnormally, the exit status is a value greater than 128 unique to that signal; otherwise, possible exit statuses are:

0 

Successful completion.

1-126 

An error occurred.

127 

A specified pid or job-id has terminated or is unknown by the invoking shell.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.

The ability to handle a job ID as well as a process ID is an extension to the XPG standard.


NOTE

This command is built into the MKS KornShell.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
sleep


PTC MKS Toolkit 10.5 Documentation Build 40.