bug-bash
[Top][All Lists]
Advanced

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

Re: associative array assignment is more constrained when using () const


From: Chet Ramey
Subject: Re: associative array assignment is more constrained when using () construct, than when using direct [] assignment
Date: Mon, 14 Nov 2011 20:38:43 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

On 11/14/11 11:15 AM, Michal Soltys wrote:
> For example:
> 
> declare -A foo
> foo['ab]']=bar
> 
> will work perfectly fine, but:
> 
> declare -A foo
> foo=( ['ab]']=bar )
> 
> will end with following error:
> 
> -bash: [ab]]=bar: bad array subscript
> 
> Same with double quotes, or backslash quoting. It's still possible to 
> quote that right bracket with backslash inside single quotes, but while
> it will do the assignment without errors, the key will be different.

Yes, you're right.  The problem is that (...) undergoes double quoting
in this case.  I've already fixed this for the next version.

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]