I realized that the following loop in a bash script will send ./a.out to background, and the run will return to the system before even a single ./a.out running is done.
#!/bin/bash for i in 1,2,3 do echo $i ./a.out done The question is how to let the next bash loop wait until "./a.out" is done?
BTW, I thought this should be a common problem but didn't find similar questions, or I may need more searching skills...
for i in 1 2 3rather thanfor i in 1,2,3.)