From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13434 invoked from network); 18 Mar 1999 09:38:57 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Mar 1999 09:38:57 -0000 Received: (qmail 16626 invoked by alias); 18 Mar 1999 09:38:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5853 Received: (qmail 14789 invoked from network); 18 Mar 1999 09:35:38 -0000 Message-Id: <9903180916.AA38484@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 From: Peter Stephenson 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 Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy