[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nounset and $! behavior

From: Chet Ramey
Subject: Re: nounset and $! behavior
Date: Mon, 12 Nov 2018 20:12:21 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]