From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23167 invoked by alias); 10 Jul 2010 15:52:48 -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: 15157 Received: (qmail 14378 invoked from network); 10 Jul 2010 15:52:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: "Benjamin R. Haskell" Cc: Zsh Users Subject: Re: Assign to parameter in parameter -- opposite of ${(P)name}? In-Reply-To: (Benjamin R. Haskell's message of "Sat, 10 Jul 2010 11:36:05 -0400 (EDT)") References: <87fwzst9ys.fsf@ft.bewatermyfriend.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Date: Sat, 10 Jul 2010 17:44:34 +0200 Message-ID: <874og7tk7x.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Benjamin R. Haskell wrote: > On Sat, 10 Jul 2010, Frank Terbeck wrote: >> Benjamin R. Haskell wrote: >> > It's the end of the week, and I'm tired, so I'm sure I'm completely >> > overlooking something obvious, but how do you *assign* to a >> > parameter whose name is in a parameter? >> [...] >> > Do I need to resort to 'eval'? >> >> % typeset foobar=baz >> % print ${foobar} >> baz >> > > I was tired... but not thaaat tired... :-) > > Using different variable names, I was looking for: > > name=xyzzy > value=asdf > > # <-- something that doesn't involve the string xyzzy > > echo $xyzzy # echoes 'asdf' Yes. But the "foobar=baz" part is just a parameter to a builtin command. Hence you can do this: % name=foobar % typeset ${name}=baz % print $foobar baz I thought that was what you were after. If not, I must have misunderstood the problem entirely. :) Regards, Frank