On Wed, Feb 04, 2015 at 03:37:07PM +0100, Piotr Grzybowski wrote:
> On Wed, Feb 4, 2015 at 2:39 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote:
> 
> > On that note, today I learned that you are not allowed to use either *
> > or @ as the index of an associative array in bash.  I guess I can see why,
> > but... that's probably going to break something some day.
> 
>  :)
>  of course you can ;-)
> 
> declare -A a; a["@"]="right"; a["*"]="hoping that you are in an empty
> directory";

Huh, that's even stranger than I thought.

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.)

Reply via email to