Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to iterate over an array of associative arrays
* Valodim Skywalker (Sun, 14 Jul 2013 18:14:37 +0200)
>
> I couldn't get that to work, either. The associative part seems to be
> lost after (P) indirection, since elements can be addressed numerically.
>
> Anyways, here's an alternative suggestion:
>
> typeset -A a1 a2;
> arr=( a2 a1 ); a1=(key val1); a2=(key val2);
> for i in $arr; echo ${(e):-\$$i\[key]}
>
> This uses (e), so beware of security implications.
...works. What for christ's sake does it do? (Of course, I could try to
figure it out on my own, but that might take a few days...)
Thorsten
Messages sorted by:
Reverse Date,
Date,
Thread,
Author