Henk is right that you need wait(1) but if you're willing to poll you won't have to wait for wait(1) save the pids like Henk suggests then periodically poll by
if ! kill -0 ${pid[i]} 2>/dev/null then # process exited -- this wait will return immediately wait ${pid[i]} # pid status is $? fi but it would be much more efficient let wait(1) do all the work as in Henk's example On Mon, 14 Apr 2008 00:27:02 +0200 Henk Langeveld wrote: > > Pablo wrote: > >> I make a script that run many process in background for speed up. > >> Each process are independent. I am interested in exit code of each process. > I missed this one condition originally: > >> How to capture exit code from each process without stop or wait? > In that case, the answer is much easier: you can't. > Wait is the only way.