I'm writing a bash script that kicks off some simulations, and then makes a bunch of plots based on the outputs generated by those simulations.
I want to run the simulations in parallel, but need the script to "block" waiting for all simulations to complete before moving on to the plot generating scripts.
pids=()
for file in inputdir/*
do
./run_simulation $file &> /dev/null & pids+=($!)
done
# synchronization barrier
for pid in ${pids[*]}; do
wait $pid
done
The current script works just fine, I'm just generally curious: what is the difference in using ${pids[*]} when compared to ${pids[@]}? (My script uses the former).