Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to iterate over an array of associative arrays
- X-seq: zsh-users 17870
- From: Valodim Skywalker <valodim@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to iterate over an array of associative arrays
- Date: Sun, 14 Jul 2013 18:14:37 +0200
- In-reply-to: <kru9g4$gbm$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <kru5ud$fse$1@ger.gmane.org> <CAHYJk3QF3Sk0PUjwr_j0OCeALhsWJM64MsB0aeeGhLkxC7osTg@mail.gmail.com> <kru9g4$gbm$1@ger.gmane.org>
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.
- V
Attachment:
signature.asc
Description: Digital signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author