![gnu并行中的bash数组printf](https://linux22.com/image/13524/gnu%E5%B9%B6%E8%A1%8C%E4%B8%AD%E7%9A%84bash%E6%95%B0%E7%BB%84printf.png)
我正在尝试将包含两个元素的 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