From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6364 invoked from network); 23 Jan 2004 23:19:55 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 23 Jan 2004 23:19:55 -0000 Received: (qmail 4449 invoked by alias); 23 Jan 2004 23:19:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7013 Received: (qmail 4436 invoked from network); 23 Jan 2004 23:19:24 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 23 Jan 2004 23:19:24 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.27.190.146] by sunsite.dk (MessageWall 1.0.8) with SMTP; 23 Jan 2004 23:19:23 -0000 Received: from ceramic.fifi.org (mail@ceramic.fifi.org [216.27.190.147]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id PAA31838; Fri, 23 Jan 2004 15:19:20 -0800 Received: from phil by ceramic.fifi.org with local (Exim 4.22) id 1AkAa8-00050u-2r; Fri, 23 Jan 2004 15:19:20 -0800 To: Omen Wild Cc: zsh users Subject: Re: Build a variable name from another variable? References: <20040123224220.GB3354@descolada.dartmouth.edu> Mail-Copies-To: nobody From: Philippe Troin Date: 23 Jan 2004 15:19:20 -0800 In-Reply-To: <20040123224220.GB3354@descolada.dartmouth.edu> Message-ID: <87oesugsnb.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Philippe Troin Omen Wild writes: > I am not totally sure what it is called, but I want to build a variable > name dynamically, from the contents of another variable. That is, I > have: > > ----- Begin script ----- > barcontents="bar contents" > baz="bar" > > echo $barcontents # <---- effect I want > echo ${${baz}contents} # <---- how I want to get there > ----- End script ----- % t="${baz}contents" % echo ${${(P)t}} bar contents Works... i could not manage to do it without an intermediate variable. Phil.