I want to run a command with different arguments in multi-threading form,
What I tried is:
#!/bin/bash
ARG1=$1
ARG2=$2
ARG3=$3
for ... #counter is i
do
main command with ARG1 ARG2 ARG3 & a[i]=$!
done
wait `echo ${a[@]}`
I used & a[i]=$!
in for loop and wait $(echo ${a[@]})
after for loop. I want my bash to wail till all threads finish then echo their pid
for me...
But when I run my script after some time it waits.
Thank you