wait
If no options or ids are supplied, wait waits for all running background jobs and the last-executed process substitution, if its process id is the same as $!, and the return status is zero.
When the shell is waiting for a job or process using the wait builtin, and job control is enabled, wait will return when the job changes state. The -f option causes wait to wait until the job or process terminates before returning.