I have an array with hostnames and I want to execute an other script with all the hostnames parallel. At first I did it iterative with a for-loop. But I want it parallel and I used the wait-command, but then I can't have dynamic number of hosts.
./sub.sh ${arr[0]} &
./sub.sh ${arr[1]} &
./sub.sh ${arr[2]}
wait
Now I need a function which with I can execute all the elements of the array. Do you have any solution for me?