Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14808

Re: nounset and $! behavior

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: nounset and $! behavior
Date 2018-11-12 20:12 -0500
Organization ITS, Case Western Reserve University
Message-ID <mailman.3955.1542071926.1284.bug-bash@gnu.org> (permalink)
References <CAMu=Brpc6TJWFmc4nvsm1H--miaSuCZ8yOTxctZbJ8yvmVBw-Q@mail.gmail.com>

Show all headers | View raw


On 11/12/18 6:55 PM, Grisha Levit wrote:
> The following crashes bash:
> 
> bash-5.0$ set -u
> bash-5.0$ echo ${!,}
> bash: $!: unbound variable
> bash: !: unbound variable

How does it `crash bash'? There's an extra error message, but it correctly
notes that $! is not set. If the shell is not interactive, it exits.


> Testing if $! is set also doesn't seem to be possible:
> 
> bash-5.0$ echo ${!-}
> bash: $!: unbound variable

Yes, this should work.

-- 
``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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: nounset and $! behavior Chet Ramey <chet.ramey@case.edu> - 2018-11-12 20:12 -0500

csiph-web