From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18612 invoked from network); 18 Mar 1999 16:01:50 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Mar 1999 16:01:50 -0000 Received: (qmail 7971 invoked by alias); 18 Mar 1999 16:01:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5856 Received: (qmail 7955 invoked from network); 18 Mar 1999 16:01:16 -0000 From: "Andrej Borsenkow" To: "Andrej Borsenkow" , "Peter Stephenson" , "Zsh hackers list" Subject: Corection RE: Final touch? RE: PATCH: more substitution documentation Date: Thu, 18 Mar 1999 18:57:42 +0300 Message-ID: <004601be7158$0e8b1810$21c9ca95@mowp.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 > > So, the whole for a ${(flags)var-mods} looks like > > 1. take the value of var. The result is list (array) of words > (may be empty or having only one element) > 2. If this is quoted and no (@) is present, join the list with > the first character if IFS (I think, it is correct? Not always > with space?) thus producing a single word (again, actually a list > with single word) > 3. apply mods separately for every word in list > 4. join the words again if (j) is present > 5. split using (s) or $= if present > 6. If no $= or (s) is present and the whole is not quoted, apply > SH_WORD_SPLIT: > 7. the result is again a (possibly empty) list of words. If the > whole is not quoted, the empty words are removed > Correction for 2 and 4: 2. If this is quoted and no (@) or (j) is present, join words with first character of IFS (tested); else if quoted and (j), but not (@), is present, join with given string. It seems, that only the last (j) (and probably (s)) is used 4. - if quoted and both (j) and (@) are present or not quoted, join with given string itsrm2% IFS=: itsrm2% foo=(a b) itsrm2% args $foo 2 a b itsrm2% args "$foo" 1 a:b itsrm2% args "${(j/x/)foo}" 1 axb itsrm2% args "${(j/x/j/y/)foo}" 1 ayb 4. - if quoted and both (j) and (@) are present or not quoted, join with given string itsrm2% foo=(a1 b1) itsrm2% args "${(@j/x/)foo%1*}" 1 axb itsrm2% args "${(j/x/)foo%1*}" 1 a1xb itsrm2% args ${(j/x/)foo%1*} 1 axb I would not call it very consistent (but, well, it mostly the same as used with splitting), but as long as you know the rules ... :-) cheers /andrej