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:20, schrieb Peter Stephenson:
On Wed, 14 May 2014 16:01:19 +0200
Florian Lindner <mailinglists@xxxxxx> wrote:
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?

(Count the responses.  I'm guessing 3 to 5...)

:-P

set -e

is standard across Bourne-like shells including zsh --- this is
equivalent to the zsh option "ERREXIT".

Problem is that set -e or ERREXIT kill my shell when called in a sourced script.

Regards,
Florian



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