On Mon, Dec 12, 2011 at 7:46 AM, Anthony R Fletcher wrote: > How can I wait for just the next job to finish? > One thing that may help you is TRAPCHLD. Sadly, the signal handler doesn't tell you what pid it is reacting to, nor the exit code. TRAPCHLD() { echo here oldpids=($pids) pids=( ) for p in $oldpids; do if kill -0 $p 2>/dev/null; then pids+=$p else #wait $p # Sadly, this doesn't work echo $p exited fi done } pids=( ) sleep 10 & pids+=$! sleep 20 & pids+=$! (sleep 15; false) & pids+=$! echo $pids wait echo done It might be nice to set an environment parameter with the pid and status info right before the dotrap(SIGCHLD) call in jobs.c. ..wayne..