From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11773 invoked from network); 11 May 2003 18:15:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 May 2003 18:15:56 -0000 Received: (qmail 25295 invoked by alias); 11 May 2003 18:15:43 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6099 Received: (qmail 25287 invoked from network); 11 May 2003 18:15:43 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 May 2003 18:15:43 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.233.9] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 May 2003 18:15:42 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h4BIFfa04024 for zsh-users@sunsite.dk; Sun, 11 May 2003 11:15:41 -0700 From: "Bart Schaefer" Message-Id: <1030511181541.ZM4023@candle.brasslantern.com> Date: Sun, 11 May 2003 18:15:41 +0000 In-Reply-To: <20030508095814.1CFD6A717C@numa-i.igpm.rwth-aachen.de> Comments: In reply to jarausch@igpm.rwth-aachen.de "array as loopvariable - howto" (May 8, 11:58am) References: <20030508095814.1CFD6A717C@numa-i.igpm.rwth-aachen.de> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: array as loopvariable - howto MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 8, 11:58am, jarausch@igpm.rwth-aachen.de wrote: } } for User in (User1,100) (User2,120); do echo "$U[1] has UID $U[2]"; } done I've seen responses on how to do this with the new multi-variable "for" syntax in 4.1, but nothing about how to do it in 4.0. I'd say the obvious solution is an associative array. 4.1 multi-variable "for": for user uid in User1 100 User2 120 ...; do echo $user has UID $uid; done 4.0 or 4.1 associative array: typeset -A umap; umap=( User1 100 User2 120 ... ) for user in ${(k)umap}; do echo $user has UID $umap[$user]; done