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


Groups > gnu.bash.bug > #16681

Re: set -u not working as expected

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: set -u not working as expected
Date 2020-08-02 16:57 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.592.1596401852.2739.bug-bash@gnu.org> (permalink)
References (2 earlier) <1867D8FC-85DD-4406-A239-3002913493AB@larryv.me> <CAH7i3Lr7ZCYJVpPZdc9xQMuF_yc_C2q0S9px+NY4prEUkU+24w@mail.gmail.com> <61B2CB9D-3978-4872-B88A-1542CF95B5B9@larryv.me> <CAH7i3LqAXNdCGjNqTGmnkimnXpz_kGnhQsiR2m7a5ezWtqe42A@mail.gmail.com> <d6ca0954-066b-c8de-a9fd-ae261b8fc3a0@case.edu>

Show all headers | View raw


On 8/2/20 4:01 AM, Oğuz wrote:

>     $ set -u
>     $ unset foo bar
>     $ typeset -i foo bar
>     $
>     $ foo+=foo+1
>     $
>     $ foo+=bar+1
>     bash: bar: unbound variable
> 
> Only referencing `bar' triggers the _unbound variable_ error, it makes
> sense that the name being assigned is immune to that.

You could make a decent case that this is a bug in bash, I suppose, but
I am comfortable with the current behavior.

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


Thread

Re: set -u not working as expected Chet Ramey <chet.ramey@case.edu> - 2020-08-02 16:57 -0400

csiph-web