zsh-users
 help / color / mirror / code / Atom feed
* How to iterate over an array of associative arrays
@ 2013-07-14 12:35 Thorsten Kampe
  2013-07-14 13:10 ` Mikael Magnusson
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Kampe @ 2013-07-14 12:35 UTC (permalink / raw)
  To: zsh-users

Hi,

I'd like to iterate over elements of an array. The elements are 
associative arrays. This is my code:

"""
#! /usr/bin/env zsh
emulate -R zsh

setopt nounset

declare -A elem AssocArr1 AssocArr2

AssocArr1=(key value1)
AssocArr2=(key value2)

array=($AssocArr1 $AssocArr2)

for elem in $array
    do echo $elem[key]
done
"""

./test.zsh:14: elem[key]: parameter not set

Thorsten


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-07-14 22:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-14 12:35 How to iterate over an array of associative arrays Thorsten Kampe
2013-07-14 13:10 ` Mikael Magnusson
2013-07-14 13:36   ` Thorsten Kampe
2013-07-14 16:14     ` Valodim Skywalker
2013-07-14 16:49       ` Thorsten Kampe
2013-07-14 17:25         ` Valodim Skywalker
2013-07-14 17:21     ` Peter Stephenson
2013-07-14 19:57       ` Thorsten Kampe
2013-07-14 22:57         ` Bart Schaefer
2013-07-14 18:05     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).