bug-bash
[Top][All Lists]
Advanced

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

Re: set -u not working as expected


From: Chet Ramey
Subject: Re: set -u not working as expected
Date: Sun, 2 Aug 2020 16:57:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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/



reply via email to

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