|
| From: | Chet Ramey |
| Subject: | Re: Work-arounds for being in "set -e" mode (Was: Re: why "shopt -p" sometime return non-zero ?) |
| Date: | Thu, 25 Sep 2025 09:13:23 -0400 |
| User-agent: | Mozilla Thunderbird |
On 9/25/25 4:07 AM, Stan Marsh wrote:
Another example is "select". If you do something like: $ set -e $ select var in one two three; do echo "var = $var"; done $ And then hit ^D at the "#?" prompt, it will exit the "select" statement with status 1 but will *not* abort the shell. So, you need to append "|| exit" after the "done", to get that behavior. Again, I'm sure there is a reason for this, but I remain unconvinced.
Korn shell compatibility, since ksh is where select originated.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
| [Prev in Thread] | Current Thread | [Next in Thread] |