From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25453 invoked by alias); 14 Jul 2013 17:21:31 -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: 17872 Received: (qmail 23793 invoked from network); 14 Jul 2013 17:21:26 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.215.175 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=5IuRlL6PxiD/kcV+iTliPbDIdn/2/R0B3KZVXHES1sI=; b=P/OwpK1qYMaAHA64whIeNNAvtfSGVmX/6pKTbaS8LbM+A4uL6Vp4TeA+h/pmrnAc5N WyGMwHaKWhZCPufZ+zVHthCvtRnm+cjvTbjbPMQtMi5JTq3h81uZ+GnJ71QczV3fd/lY M9EdrpPA+leP1pFjquhOg5zfN5xPRrdAjJVOe046tDiLPjzuAWf1oJFy85ZbxQvjuRBP peoF46wMi3eAuIg+y9kHxNxDNsOJM/WM2b2bxAKhIQyw3nNLlhZ0C98WlGQZFNkvdT7m LRfAC0mNkf5+gsUiXTv2e4LFjj308qU3Ql+A9OL981aLQaUZwCHc/Ygv2UwUQ2+PSyRc gAlg== X-Received: by 10.14.47.73 with SMTP id s49mr9670372eeb.71.1373822480415; Sun, 14 Jul 2013 10:21:20 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Sun, 14 Jul 2013 18:21:17 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: How to iterate over an array of associative arrays Message-ID: <20130714182117.221d3501@pws-pc.ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnXDw/YU34tJP2tlJmdJipnwagRbgJLG7Ww9hoayrzqZk8iDYrfZoqY9lMPFj5QLfxIk0Ic On Sun, 14 Jul 2013 15:36:03 +0200 Thorsten Kampe wrote: > Yes, I really wanted to pass the actual associative arrays, but if I can > pass the names that's fine with me, too. So maybe you're looking for: typeset -A AssocArr1 AssocArr2 typeset -a array typeset key value AssocArr1=(key1 value1) AssocArr2=(key2 value2) # array is a normal array containing key/value pairs array=(${(kv)AssocArr1} ${(kv)AssocArr2}) # scan array by pairs for key value in $array do echo $key $value done ? -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/