From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9740 invoked from network); 8 May 2003 10:33:42 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 8 May 2003 10:33:42 -0000 Received: (qmail 5782 invoked by alias); 8 May 2003 10:33:30 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6089 Received: (qmail 5774 invoked from network); 8 May 2003 10:33:30 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 8 May 2003 10:33:30 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 8 May 2003 10:33:30 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Thu, 8 May 2003 11:43:07 +0100 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id JWCPY4AG; Thu, 8 May 2003 11:31:29 +0100 To: zsh-users@sunsite.dk Subject: Re: array as loopvariable - howto In-reply-to: "jarausch@igpm.rwth-aachen.de"'s message of "Thu, 08 May 2003 11:58:14 +0200." <20030508095814.1CFD6A717C@numa-i.igpm.rwth-aachen.de> Date: Thu, 08 May 2003 11:33:27 +0100 Message-ID: <18467.1052390007@csr.com> From: Peter Stephenson jarausch@igpm.rwth-aachen.de wrote: > I would like to write a loop over a list of arrays, > > e.g. I would like to iterate over pairs of (username,UID) > > A naiv try like > > for User in (User1,100) (User2,120); do echo "$U[1] has UID $U[2]"; > done > > failed. > Is this possible in ZSH? >>From 4.1.1 which is appearing Real Soon Now (TM) you can do for User Uid in User1 100 User2 120; do echo "$User has UID $User2" done (You are encouraged to try out 4.1.1-test-2 if you are at all interested in upgrading.) Until then, you are stuck with either indexing multiple real arrays or tricks with word splitting. -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************