GNU/Linux Command – WAIT

wait — Await process(es) completion

Wait is a bash built-in command. It will return after all the mentioned process Ids are terminated. The exit status of the wait will be the exit status of the last terminated process. If no PID is mentioned, then it shall wait until all process IDs known to the invoking shell have terminated and exit with a zero exit status. It is very useful to manage asynchronous events.

$ sleep 10 & -- Dummy and it is the only process in thecurrent shell. $ wait -- Wait until the sleep get terminated. $ wait 123 -- Wait until the process 123 get terminated. $ wait 123 456 -- Wait until all processes get terminated.
Read: man wait or help wait

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: