Wait for Background Jobs
SH · Process Managementsyntax
wait [pid|%job]example
process_a &
process_b &
wait
echo 'Both finished'Note wait with no arguments paits for all background jobs. With a PID or job spec, it waits for just that one. Useful in scripts to parallelize tasks and then synchronize before continuing.