From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22992 invoked from network); 3 Oct 2006 17:26:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Oct 2006 17:26:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33516 invoked from network); 3 Oct 2006 17:26:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Oct 2006 17:26:05 -0000 Received: (qmail 13085 invoked by alias); 3 Oct 2006 17:25:58 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10779 Received: (qmail 13075 invoked from network); 3 Oct 2006 17:25:58 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Oct 2006 17:25:58 -0000 Received: (qmail 32415 invoked from network); 3 Oct 2006 17:25:58 -0000 Received: from mx2-2.spamtrap.magma.ca (209.217.78.161) by a.mx.sunsite.dk with SMTP; 3 Oct 2006 17:25:56 -0000 Received: from mail1.magma.ca (mail1.internal.magma.ca [10.0.10.11]) by mx2-2.spamtrap.magma.ca (8.13.1/8.13.1) with ESMTP id k93HPkhX031485 for ; Tue, 3 Oct 2006 13:25:46 -0400 Received: from princo.homelinux.org (ottawa-hs-64-26-167-168.d-ip.magma.ca [64.26.167.168]) by mail1.magma.ca (Magma's Mail Server) with ESMTP id k93HPjVC019852 for ; Tue, 3 Oct 2006 13:25:46 -0400 Received: from jrdavid by princo.homelinux.org with local (Exim 3.36 #1 (Debian)) id 1GUo1Z-00057A-00 for ; Tue, 03 Oct 2006 13:25:45 -0400 Date: Tue, 3 Oct 2006 13:25:45 -0400 From: Jean-Rene David To: zsh-users@sunsite.dk Subject: Re: Array indirection Message-ID: <20061003172545.GB15118@princo> Mail-Followup-To: zsh-users@sunsite.dk References: <20061003155428.GA10503@itl.waw.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20061003155428.GA10503@itl.waw.pl> User-Agent: Mutt/1.5.13 (2006-08-11) X-magma-MailScanner-Information: Magma Mailscanner Service X-magma-MailScanner: Clean * Wojciech Pietron [2006.10.03 12:00]: > ================================================== > #!/bin/zsh > > names=(peter ann) > digits=(one two three four) > analyze=(names digits) > > for t in $analyze; do > for ((i=1; i<=${(P)#t}; i++)); do > #No problems with displaying the indirect tables > echo ${(P)t} > done > done > ================================================== > > I have no problems with displaying the contents of the indirect table > inside of the inner loop but how can I do the following operations there: > - displaying i-th element of the array; print -r -- "${(P)${t}[$i]}" > - setting i-th element of the array. eval "${t}[$i]=foobar" HTH, -- JR