Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Stop script if one command returns != 0



Am 14.05.2014 16:01, schrieb Florian Lindner:
Hello,

I have a script that I source with a number of commands and exports.
Is there a way to tell zsh (or even in a portable way to sh) to stop
execution of this script if any of the commands returns a return code
other than zero?

Ok, just a second after the mail I learned about set -e. The problem is when sourcing the script it kills my entire shell.

I tried installing a trap

trap 'echo "Hallo"' TERM INT ABRT EXIT

(just a as first shot, trying to catch almost anything) but changed nothing.

Any ideas how do deal with that?

Thanks!

Florian



Messages sorted by: Reverse Date, Date, Thread, Author