Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Another interesting (P) effect
- X-seq: zsh-workers 37118
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Another interesting (P) effect
- Date: Sun, 15 Nov 2015 10:08:14 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=4PFwDJIq/K9m3bXw3gUw+KkD3aUh8GdCNn+Oy/V0MTg=; b=YYeUN0CRu6r+eX8ryDA41mougmcrOEP1DcA1aLb6DCCumlcVYYDoiHHAytFw/5LWvF SwGZjXtiPIovlQK5nZXiaUxzDSzl50KwCLZl31jFrhXUj054qOdqhwfK2AdaaHOyoWIN GW+ayndtz/fNUiDk71U9v0m48y/APdgX99AQtrgEhWZnGvNEWwsjqPepma3ZVdJYARmE Wyrc0m3Vd6sYHe4QaByc6sN8HoTp6JGNqkgX/LqdTNoVLYBr1vpaIwsPcX65dJ+CzUwn azhqQhOVY6WFocvUIFf1pNKUOryrrMpDXXpofCMwFOTUBg+fkM/nL553N5lK+4XMb5Oo KXZg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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