wait — Await process(es) completionSummary:
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. Examples:
$ 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