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

Re: PATCH: nested ${(P)} (formerly SHWORDSPLIT and leading spaces)



On Nov 11, 2015 9:59 AM, "Peter Stephenson" <p.stephenson@xxxxxxxxxxx>
wrote:
>
> This isn't obviously broken, yet.  You can explore while I think about
> tests.

Nifty.

> Hmmm... should I sanity check that the the substituted name is an
> identifier, or is it a feature that
>
> % array=(one two three)
> % word='array[2]'
> % print ${${(P)word}[2]}
> w
>
> works?

I've used that trick before, though the context was with nested (P) not
working.  I guess I'd leave it as a feature ... essentially if the value
would be legal as the left side of an assignment, it should be OK here.

Check ${(P)thing::=newvalue} too ...


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