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

Re: simple substitution?



tartifola@xxxxxxxxx <tartifola@xxxxxxxxx>:
> I'm trying to understand expansion end substitution and I'm lost in
> what should be a simple substitution. Here my example
> 
> >foo=4
> >echo ${foo}
> 4
> >FO=fo
> >O=o
> >echo \${${FO}${O}}
> ${foo}
> 
> while I was expecting '4'. What am I missing?

What would make you think that in the first place?
You can get that effect by doing:

[snip]
foo=4
FO=fo
O=o
print ${(P)${:-$FO$O}}
[snap]

Details can be found in 'man zshexpn'.

Regards, Frank



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