[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unsetting all elements of an associative array
From: |
Chet Ramey |
Subject: |
Re: Unsetting all elements of an associative array |
Date: |
Wed, 04 Feb 2015 16:22:13 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 2/4/15 9:42 AM, Greg Wooledge wrote:
> imadev:~$ unset a; declare -A a; a=(["@"]=foo [!]=bar); declare -p a
> declare -A a='([@]="foo" ["!"]="bar" )'
>
> imadev:~$ unset a; declare -A a='([@]="foo" ["!"]="bar" )'
> bash: [@]="foo": invalid associative array key
>
> If the declare -p output is intended to be reusable shell code, then
> this is surely a bug. (Bash 4.3.30.)
You're right, it should be quoted.
--
``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/
Re: Unsetting all elements of an associative array, konsolebox, 2015/02/04