bug-bash
[Top][All Lists]
Advanced

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

Re: nameref subscript assignment with unset target var


From: Chet Ramey
Subject: Re: nameref subscript assignment with unset target var
Date: Wed, 18 May 2016 16:49:52 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

On 5/17/16 4:40 PM, Grisha Levit wrote:
> Multiple variables with the same name are created at the same scope when
> doing assignments to subscripts of nameref variables that point to
> variables that are unset.
> 
> |$ unset var; declare -n ref=var; ref[0]=foo $ declare -p ref declare -a
> ref=([0]="foo") |
> 
> I think the more reasonable thing would be to create a new array variable 
> $var.

I agree.  I'll fix this for bash-4.4.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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