我正在使用带有Torque/Maui系统的集群.我有一个使用qsub命令提交一个作业的bash脚本,然后做了几件事,比如移动文件,写ASCII文件,并检查我提交的作业的输出.关于此输出,基本上,如果它包含数字1,则需要再次提交作业.如果不同于1,则bash脚本会执行其他操作.
问题是qsub在后台运行,并且所有bash都会立即进行评估.我想强迫qsub表现得非常像awk,cat,sort等...当脚本在这些命令完成后进一步发展 - 如果没有放在后台.
所以,我需要在第一个qsub上停止bash,并在qsub完成后继续运行,这意味着,当作业完成时.有没有办法做到这一点?它将类似于:
-sync y # in the SGE system, for instance.
Run Code Online (Sandbox Code Playgroud)
是)我有的:
#!/bin/bash
.
.
some commands
.
.
qsub my_application # need to wait until my_application get done
.
.
more commands
.
.
my_application_output=(`cat my_application_output.txt`)
case "$my_application_output" in
["1"])
qsub my_application
;;
["0"])
some commands
;;
["100"])
some commands
;;
*)
some commands
exit 1
esac
.
.
Run Code Online (Sandbox Code Playgroud)
一些言论
谢谢大家
我需要读取coordinates.ascii只有一行的ASCII文件:
-I0.00130000258937/0.000899999864241
Run Code Online (Sandbox Code Playgroud)
一个bash脚本里面,属性0.00130000258937的变量x_inc并0.000899999864241给y_inc.猜猜正则表达式x_inc是:
(\d.\d+)(?=/)
Run Code Online (Sandbox Code Playgroud)
但我不知道y_inc的正则表达式以及sed或grep命令/语法在bash中实现regexp ..
x_inc=$(sed -n '(\d.\d+)(?=/)' coordinates.ascii ) # does not work!!!
Run Code Online (Sandbox Code Playgroud)