Given a background process that has exited before the script got to wait -n:
function foo() { return 1; } foo & FOO_PID=$! function bar() { sleep 1; } bar & BAR_PID=$! sleep 0.1 # should exit with 127 since FOO_PID is non-existent now wait -n $FOO_PID $BAR_PID Then wait -n will wait on BAR_PID to exit, despite the fact that FOO_PID is invalid. (Tested with 5.0.17.) Shouldn't it immediately exit with 127, as the docs suggest, since one id specifies a non-existent process? The way it currently works makes it hard to make a script that waits for one of a set of background processes to exit (ie. that fails if one of a set of background processes fails), since any error that happens before the script reaches the wait will simply be ignored.