Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Stop script if one command returns != 0
On Wed, 14 May 2014 15:35:44 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> Wrap your sourced file in a function and use the zsh-specific option
> ERR_RETURN.
>
> source_with_err_return() {
> setopt localoptions errreturn
> source "$@"
> }
(I haven't got the reposted mail I'm replying to yet, so you might see
this first...)
It turns out I was accidentally or otherwise smart enough to make
err_return apply to sourced files, so if you don't want function scope
you can get away with...
{
setopt err_return
source ./script
} always {
unsetopt err_return
}
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author