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

Re: TRAPEXIT question



Greg Klanderman wrote:
> So is there an easy way to indirect through the value of a variable?
> I know I can use eval, but, for example, in BASH you can do
> 
> foo=bar
> bar=baz
> echo ${!foo}   -> baz

The zsh equivalent (from 3.1.6) is

  foo=bar
  bar=baz
  echo ${(P)foo}

There may be some reason why didn't use !, which I think was mentioned at
some point, but I can't remember what it was.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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