Wait till any one child process finishes

Hi

I am facing a problem in my ksh.
My main script is calling 3 different child process in the background.
I am using wait to finish all and then submit another 3 child processes.
Now what i want is , whenever any one child process finishes ,i want to submit next one.so that parallel 3 processes should run all together.

I tried wait -n ,but it did not work in ksh

It's a good idea to post your entire script if you want the best help you can get here at unix.com.

When you post your script, many people will review it and help you, for sure.

It's the best way forward, really :slight_smile:

This problem has been discussed umpteen times in these forums, e.g. here.
I'd recommend using jobs -r to avoid counting non-running jobs; if this bash ism is not available in ksh , try jobs| grep -c "running"

What did you expect to accomplish with this? Both man ksh ( wait [job] ) and man bash ( wait [n] ) don't have a minus sign.