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

How to iterate over an array of associative arrays



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



Messages sorted by: Reverse Date, Date, Thread, Author