Zsh Mailing List Archive
Messages sorted by:
Re: [PATCH] don't exit shell on [[ -o invalid@option ]]
- X-seq: zsh-workers 42007
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] don't exit shell on [[ -o invalid@option ]]
- Date: Fri, 10 Nov 2017 14:37:17 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Lpv5Ian1gJcij7coHTT4DjthbsoL+iVzZIGZ3Dw960E=; b=YoHpGUqiiesSh14JBhZSQbdEI7jFXFg3fpKFlUUehaymw0a0RPMlFgVyY82kMy2Gjw 01bLYYAP7M2mxgGae+2OQb4rIiEQgMM2fBNPsVqtGhpoxbfFEbEUFpScILZMrgZFj1+8 dVz4GVszwbvm2EHTwdP1AWyyL3w7KYH2lQHZ/MX8ZIdvknNVhtn3FDZ5Wtu3FdSyhnQb FuKbOfOCff3DtdurNPq4EuYaU5TG6+CI4S2o7KzMGKiSAu+eppCc7yqJq6zJdKYYD+m9 Rh7iD2KOV0rbL7m1wNjRFm+7oNoGusjFqHqGcGD2B4t3TIeDfqXnB/9gLKGuXaTlNNso UdNA==
- In-reply-to: <firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- List-unsubscribe: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org>
On Nov 10, 6:24pm, Martijn Dekker wrote:
} Does it make sense for [[ -o invalid@option ]] to exit the shell with an
} error message?
I have the impression that this was discussed on the list before, some
time ago, and the conclusion was that it was useful to be able to tell
[[ -o an_option_typo ]] apart from [[ -o an_unset_option ]].
In other words, if the option doesn't exist at all, then for any code
depending on the result of the test, both the true and false branches
may very well be wrong.
It's easy enough to write backwards-compatible code by simply adding a
subshell around the test, if that's what's intended.
We could certainly suppress the error in emulation modes given that's
what other shells do. Further, I'm not strongly invested in the current
behavior even for native mode, but we should consider the ramifications.
Messages sorted by: