I have two scripts say ‘S1’ and ‘S2’. I execute these scripts as,
nohup S1 &
nohup S2 &
But I would like them to execute sequentially. ie., S2 should execute only on successful completion of S1. How should I go about doing this?. How can I know when S1 finishes execution?. Any examples would be much appreciated. Thanks.
You can execute them, sequentially, like this:
Try
The double ampersand operator is described here.
Note that when using
&&,S2only runs ifS1finishes “successfully” (return code 0). This seems to be what you wanted. If you wantS2to run regardless of whetherS1succeeds, use;instead of&&.