如果我知道我运行的作业的名称,我怎么能通过脚本只返回它的 jobID。
例如,运行sacct --name run.sh返回以下输出,我只想返回50( jobID)。
$ sacct --name run.sh
JobID JobName Partition Account AllocCPUS State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
50 run.sh debug alper 1 COMPLETED 0:0
50.batch batch alper 1 COMPLETED 0:0
作为一个解决方案,我可以运行:sacct --name run.sh | head -n3 | tail -n1 | awk '{print $1}'返回50,但有时其他作业的顺序50和50.batch更改。