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

variable expansion inside string



Hello, is it possibile to do only variable expansion inside a string, eg:

file="filename.txt"
a="*$file*"

I would like to print $a as:

*filename.txt*

I have tried ${(P)a}
and
eval echo -n - $a

but neither do what I would like, because $a does not contains only a
variable name, and the * are expanded by glob subst in the eval case.

thanks in advance

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


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