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

Re: Bad expansion

    Hello Bart :)

>> >>    # Bad substitution
>> >>    echo ${${testing[1]}_VALUE}
>> >echo ${(e):-\$${testing[1]}_VALUE}
>> >The :-\ is a smiley that means "maybe there ought to be a neater way".
>>     Are you joking?
>Yes, he is.

    I knew, just a rethoric question ;))))

>>     "Expand <NULL> identifier, and, if it is not defined or missing
>> (which is true), expand the other thing, that is, \$${testing[1]}_VALUE"
>Almost.  You forgot about the (e).  The whole expression means:

    Oh, I see O:)) The expansions... I was misguided by the smiley XDD

>>     Seriously: why am I having the 'bad substitution' error? What am
>> I doing wrong?. This interest me more than the solution.
>Anything that looks like ${${...}} is called a "nested substitution".  The
>stuff inside the outermost ${...} can take one of two forms:
>(1) it can be the name of a parameter (in which case the substitution is
>    not nested, of course), plus an optional [...] subscript;
>(2) it can be another ${...} substitution expression plus an optional
>    subscript.

    Crystal clear now. I didn't understand the rules for nested
substitution on the zsh manual. Thanks a lot :)

    You are of invaluable help, truly. It's people like Zefram and
you that makes me proud of using Linux, Zsh and all that good free
software out there. You're great.


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