From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29417 invoked by alias); 14 Jul 2013 16:22:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17870 Received: (qmail 27725 invoked from network); 14 Jul 2013 16:21:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at mugenguild.com does not designate permitted sender hosts) Date: Sun, 14 Jul 2013 18:14:37 +0200 From: Valodim Skywalker To: zsh-users@zsh.org Subject: Re: How to iterate over an array of associative arrays Message-ID: <20130714161437.GA25112@mugenguild.com> Mail-Followup-To: zsh-users@zsh.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --r5Pyd7+fXNt84Ff3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlHizm0ACgkQxCa+aHUWYdRV2ACfculYauWfuSQE7JGUDW2JJApF 8KcAoKs88U7stP8n/w0jjABc+3Fd4agO =NxMu -----END PGP SIGNATURE----- --r5Pyd7+fXNt84Ff3--