mettre en pause un script shell jusqu’à ce que la commande précédente se termine

J’ai un script shell qui a une commande qsub suivie par une autre commande qui dépend de la sortie de la commande qsub. J’ai un script shell qui ressemble à

qsub  cat  grep  

Je veux que le qsub se termine avant que le script ne passe à la commande cat. J’ai mis “wait” après le qsub, mais n’a pas fonctionné.

Ajoutez “-sync y” à la ligne de commande qsub.

A partir du manuel dans: http://gridscheduler.sourceforge.net/htmlman/htmlman1/qsub.html

  -sync y[es]|n[o] -sync y causes qsub to wait for the job to complete before exiting. If the job completes successfully, qsub's exit code will be that of the completed job. If the job fails to complete successfully, qsub will print out a error message indicating why the job failed and will have an exit code of 1. If qsub is interrupted, eg with CTRL-C, before the job completes, the job will be canceled. With the -sync n option, qsub will exit with an exit code of 0 as soon as the job is submitted successfully. -sync n is default for qsub.