w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Wait for .sh script to finish before executing another .sh script?

Simply use the && connector (i.e. a compound-command):

./script1.sh && ./script2.sh

But please consider that in this case the second script will be executed only if the first returns a 0 exit code (i.e. no error). If you want to execute the sequence whatever the result of the first script, simply go:

./script1.sh ; ./script2.sh

You can test the behaviour of the two connectors:

$ true && echo aa
aa
$ false && echo aa
$ false ; echo aa
aa




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.