What process does the wait command use to determine which process is done?

57 Views Asked by At

I have a for loop in a shell script that runs like:

for ((i=1; i<=N; i++))
 do
   eval $cmd
   wait
 done

and my issue is that $cmd is in the form:

numactl --physcpu=0-0 --membind=0 [SCRIPT] &
numactl --physcpu=1-1 --membind=0 [SCRIPT] &
numactl --physcpu=2-2 --membind=0 [SCRIPT] &
...
numactl --physcpu=20-20 --membind=0 [SCRIPT] 

Which of these processes does the WAIT command wait to finish? Is it all of them? If not, how should I go about making it so that each iteration of the forloop only runs after all 20 instances of SCRIPT are finished?

0

There are 0 best solutions below