gnu并行中的bash数组printf

gnu并行中的bash数组printf

我正在尝试将包含两个元素的 bash 数组变量传递给 GNU 并行脚本:

echo ${opts[@]}                                                                                                                                                    
-s 100206 -i /input/100206/unprocessed/3T/T1w_MPR1/100206_3T_T1w_MPR1.nii.gz -s 100408 -i /input/100408/unprocessed/3T/T1w_MPR1/100408_3T_T1w_MPR1.nii.gz 

我尝试像这样运行它

printf '%s\n' "${opts[@]}" | parallel --jobs 8 --timeout 250% --progress recon-all {.} -all -qcache

看来我使用printf错误:

printf '%s\n' "${opts[@]}"                                                                                                                                         
-s                                                                                                                                                                                         
100206                                                                                                                                                                                     
-i                                                                                                                                                                                         
/input/100206/unprocessed/3T/T1w_MPR1/100206_3T_T1w_MPR1.nii.gz                                                                                                                            
-s                                                                                                                                                                                         
100408                                                                                                                                                                                     
-i                                                                                                                                                                                         
/input/100408/unprocessed/3T/T1w_MPR1/100408_3T_T1w_MPR1.nii.gz

答案1

我认为每个命令需要 4 条记录:

printf '%s\n' "${opts[@]}" |
  parallel --jobs 8 -n4 --timeout 250% --progress recon-all {.} -all -qcache

相关内容