On 2015-09-07 11:15, Steve Engledow wrote:
You can use the special bash variable `$?` to get the return code of the last command that run.
That or adding "set -e" as one of the first lines in the script. Setting this option causes the shell to stop executing the script on the first error (i.e. the first non-zero return code).
Thomas