I want to run multiple processes in parallel using bash. I did the following:
./proc sth1 & ./proc sth2 & ./proc sth3 & ... & ./proc sthN &
The problem with the above is that it immediately ends. So if I do:
time (./proc sth1 & ... & ./proc sthN &) I get back 0.
I want to run the above command but I want it to stop when the last process has finished.
So if ./proc sthX takes 10 seconds while all the other processes take 1 second. I want to wait for 10 seconds till the above command returns. Is there a way to do this?