Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
'case' zeroes "$?"
- X-seq: zsh-workers 39596
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: 'case' zeroes "$?"
- Date: Sun, 9 Oct 2016 23:01:35 +0200
- 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
Unlike on other shells, 'case' on zsh zeroes "$?" before executing a
command within 'case', making it more inconvenient to test exit status.
Example:
(exit 37) || case $? in 37) echo "$?";; esac
All shells except zsh and Busybox ash output 37; zsh outputs 0.
(dash recently fixed this: 0.5.8 outputs 0, 0.5.9.1 outputs 37.)
Thanks,
- Martijn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author