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

Re: Nested substitutions.

On Feb 4,  6:05pm, Larry P . Schrof wrote:
> Subject: Nested substitutions.
> I will ask a question through an example...
> I have a variable called E. It contains the string EDITOR.
> I have a variable EDITOR set to /usr/local/bin/emacs.
> I would like to obtain the value of EDITOR through E.

We just had this discussion at great length.  Too bad the HTTP mailing list
archive is down right now.  When it comes back, I hope somebody can send a
message to zsh-announce to let people know.

Aside from the reasons why ${${E}} doesn't do what you expect, which I'm
reluctant to repeat again, the absolutely shortest answer is to use


I should have thought of this one the last time this came up; it does mean
exactly what ${${E}} only looks like it means.

This works in every version of zsh that supports the (e) flag, AFAIK.  Hey,
Peter: FAQ item?

If you happen to have built the latest development version of zsh with all
the patches that have appeared in the last six days, ${(P)E} is the same.

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