Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
'set -e' with '!' POSIX issue
- X-seq: zsh-workers 39536
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: 'set -e' with '!' POSIX issue
- Date: Sun, 2 Oct 2016 11:01:18 +0100
- 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
'set -e' ('set -o errexit') is not POSIX compliant on zsh because it
doesn't ignore a command beginning with "!".
The script:
set -e
! true
echo good
should output "good", and does, on every shell except zsh.
Ref.:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
| 2. The -e setting shall be ignored when executing the compound list
| following the while, until, if, or elif reserved word, a pipeline
| beginning with the ! reserved word, or any command of an AND-OR list
| other than the last.
(Note that in POSIX terms the definition of "pipeline" includes a simple
command.)
Thanks,
- Martijn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author