Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Spaces in associative array keys



zagzig<1> typeset -A foo
zagzig<2> foo[bar]=fred
zagzig<3> foo[7]="the winter of our discontent"
zagzig<4> foo[$foo[7]]=shakespeare
zsh: bad math expression: unbalanced stack
zagzig<5> print -l "$foo[@]"
shakespeare
the winter of our discontent
fred
zagzig<6> print -l "${(k)foo[@]}"
the winter of our discontent
7
bar

The only way I could get zsh to accept spaces in the [ ] was to use a
variable reference, and then I get the "unbalanced stack" error on the
first reference, even though it does work thereafter.

Gotta go now, perhaps more on this over the weekend.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author