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

Another interesting (P) effect



This isn't new, but given that ${(P)${(f)lines} is an example in the
"Rules" (rule 23), seems worth mentioning:

torch% a=AYY
torch% abc=AYYBEESEE
torch% lines=$'a\nb\nc'
torch% print ${(P)${(f)lines}} 
AYY

So (P) parses off the first thing that looks like a parameter name and
discards everything else, with no error.

torch% IFS='' eval 'print ${(P)${(f)lines}}'
AYYBEESEE



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