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

Re: variable expansion inside string



So really what you're trying to do is: given a variable "a" containing
exactly the literal characters

*$file*

(however they got there) expand any variable references, but nothing
else.

The nearest I can think of is:

print -r -- "${(e):-$a}"

That won't be limited to just variables, it'll do other sorts
of expansion, but it won't do globbing, and you don't have the
hairiness of an "eval".

pws



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