Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Assign to parameter in parameter -- opposite of ${(P)name}?



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'



Messages sorted by: Reverse Date, Date, Thread, Author