You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何正确在GNU parallel命令中使用:::传递多系统参数?

解决GNU Parallel批量执行nimadm命令的问题

你的问题出在GNU Parallel的语法使用错误:::: 是用来指定待替换的参数列表的,你把它放在了命令中间,导致Parallel将:::之后的所有内容(包括固定参数如-l lppsource73)都当成了独立的任务项,而非命令的固定部分。

正确的写法是把固定参数完整写入命令模板,用{}作为系统名的占位符,再通过:::传入$HOSTS中的系统列表:

parallel nimadm -c {} -l lppsource73 -s spot73 -o bosinst_migration_73 -j nimadm_vg -d hdisk0 -Y ::: $HOSTS

补充说明:

  • {}会被$HOSTS中的每个系统名依次替换,保证每个任务都执行完整的nimadm命令。
  • 如果$HOSTS中的系统名包含空格或特殊字符,建议将其定义为数组并使用数组展开:
    HOSTS=("sys1" "sys2 with space" "sys3")
    parallel nimadm -c {} -l lppsource73 -s spot73 -o bosinst_migration_73 -j nimadm_vg -d hdisk0 -Y ::: "${HOSTS[@]}"
    

内容的提问来源于stack exchange,提问作者Jörg Kauke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 22:15:30