Hello all,
I am trying to run a program with different arguments which are read from a bash array. So far I had been doing
x=(0.1 0.2 0.3) # the arguments
for i in $(seq 0 1 2)
do
my_program ${x[$i]} &
done
This would run my_program for all arguments in parallel.
I have been trying to achieve the same result using GNU parallel but have not been able to so far. I have been trying (I have replace my_program by echo for simplicity)
(1) seq 0 1 2 | parallel echo ${x[{1}]}
(2) seq 0 1 2 | parallel echo $"{"x[{1}]"}"
(3) seq 0 1 2 | parallel echo \${x[{1}]}
with
outputs
(1) bash: {1}: syntax error: operand expected (error token is "{1}")
(2) no output
(3) {x[0]}
{x[1]}
{x[2]}
Is there any way to get what is expected, i.e.
0.1
0.2
0.3
?
I have read the parallel manual about quoting but have not worked it out completely... Thanks in advance for any suggestions!