且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取作业ID并将其放入bash命令

更新时间:2023-01-30 20:40:38

您可以使用

for job in Job*.sh ; do sbatch --parsable $job; done | paste -s -d: | xargs -I{} sbatch --depedency afterok:{} final.sh

paste命令将收集所有作业IDS,并将它们写在一行中,用冒号分隔,而xargs将获取结果并将其插入到{}占位符中.有关作业ID的信息是通过管道传递的.

The paste command will gather all job IDS and write them on a single line, colon-separated, while xargs will take the result and insert it at the {} placeholder. The information about the job IDs is passed through pipes.