I would like to run n processes (in my case simulations) simultaneously, so I’m using & like so:
for i in {1..50};
do
run simulation &
done
After each simulation is done I need to parse its output files. My question is how do I know when a process is done, and what do I do to invoke a function upon finishing a process?
EDIT: I think what I need to do is call a function that would invoke the simulation and parse its files after it is done. The way I see it this function has to be a child process anyway, right?
Thanks!
As you don’t seem to want/need to wait until all simulations are done, you can simply do this: