I have a script with
for i in 1 2 3 4; do do_something $i & done
And when I call it, it terminates before all
do_something terminated. I found this question with many different answers.
help wait tells me that
If ID is not given, waits for all currently active child processes, and the return status is zero.
Is it not sufficient to just add a single
wait at the end?