Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: set -e (no && or ||)
- X-seq: zsh-workers 30729
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: set -e (no && or ||)
- Date: Fri, 12 Oct 2012 06:29:23 -0700
- In-reply-to: <CAECNH1RQxAH3DvSCVagR_DQHqA6Cpi2U+0p9m3=rhp=kDSnGCQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20121012110542.314890@gmx.com> <CAECNH1RQxAH3DvSCVagR_DQHqA6Cpi2U+0p9m3=rhp=kDSnGCQ@mail.gmail.com>
On Oct 12, 12:53pm, Peter Stephenson wrote:
} Subject: Re: set -e (no && or ||)
}
} On Fri, 12 Oct 2012 07:05:41 -0400
} Sergey Fadeev <hindsight@xxxxxxxxx> wrote:
}
} > Why doesn't it exit the shell?
} > $ set -e
} > $ echo $(false)
} > Shouldn't the error code of $(false) command substitution be checked
} > by set -e before passing stdout to the echo builtin?
}
} No, because the command was "echo", and that didn't fail.
The idea being that not every nonzero status is an error, and -e means
to exit on error.
For example, you generally don't want the shell to exit on something
like this:
while read line
then echo This should eventually stop
fi
echo But you probably want to arrive here without exiting
Messages sorted by:
Reverse Date,
Date,
Thread,
Author