From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: more substitution documentation
Date: Thu, 18 Mar 1999 10:16:17 +0100 [thread overview]
Message-ID: <9903180916.AA38484@ibmth.df.unipi.it> (raw)
This is more less my explanation of Andrej's other query yesterday, which I
think I now understand. If anyone wants to suggest rearranging the
information in this part of the manual, please go ahead and say where you
want it to appear.
--- Doc/Zsh/expn.yo.js Wed Mar 17 11:51:19 1999
+++ Doc/Zsh/expn.yo Thu Mar 18 10:11:47 1999
@@ -729,6 +729,21 @@
)
enditem()
+Any joining and splitting of words which is necessary occurs in that order,
+and after any other substitutions performed on the value at that level of
+substitution; this includes implicit splitting on the characters in
+tt($IFS) when the option tt(SH_WORD_SPLIT) is set. In particular, when
+splitting is requested on an array value it is first joined, either using
+any string given by the tt(LPAR()j)tt(RPAR()) flag, or a space if there is
+none. So if tt($foo) contains the array tt(LPAR()ax1 bx1)tt(RPAR()), then
+tt(${(s/x/)foo}) produces the words `tt(a)', `tt(1 b)' and `tt(1)', while
+tt(${(j/x/s/x/)foo}) produces `tt(a)', `tt(1)', `tt(b)' and `tt(1)'. As
+substituion occurs before either joining or splitting, the operation
+tt(${(s/x/)foo%%1*}) first generates the modified array tt(LPAR()ax
+bx)tt(RPAR()), which is joined to give tt("ax bx"), and then split to give
+`tt(a)', `tt( b)' and `'. The final empty string will then be elided, as
+it is not in double quotes.
+
texinode(Command Substitution)(Arithmetic Expansion)(Parameter Expansion)(Expansion)
sect(Command Substitution)
cindex(command substitution)
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
next reply other threads:[~1999-03-18 9:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-18 9:16 Peter Stephenson [this message]
1999-03-18 15:23 ` Final touch? " Andrej Borsenkow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9903180916.AA38484@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).