tilHow to Parallelize a Script in Bash
For running scriptName.sh
, while passing in option of an index of arrayThatVaries
:
arrayThatVaries=(
"entry1"
"entry2"
"entry3"
)
(trap 'kill 0' SIGINT; for i in "${!arrayThatVaries[@]}"; do
scriptName.sh --option "${arrayThatVaries[$i]}" --index "$i" &
done
wait)