|
From: | Cook, Malcolm |
Subject: | RE: bash arrays in parallel |
Date: | Mon, 9 Jan 2012 09:11:48 -0600 |
parallel my_program ::: ${x[@]} ~Malcolm From: parallel-bounces+mec=stowers.org@gnu.org [mailto:parallel-bounces+mec=stowers.org@gnu.org] On Behalf Of giorgos sermaidis 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]} 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! |
[Prev in Thread] | Current Thread | [Next in Thread] |