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

Re: How to iterate over an array of associative arrays



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