From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 594 invoked from network); 4 May 2000 07:02:49 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 May 2000 07:02:49 -0000 Received: (qmail 29540 invoked by alias); 4 May 2000 07:02:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11138 Received: (qmail 29527 invoked from network); 4 May 2000 07:02:40 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Bart Schaefer" , "Zsh hackers list" , "Sven Wischnowsky" Subject: Let's do it RE: Should we backup this change? RE: Modifier substitutions. Date: Thu, 4 May 2000 11:02:35 +0400 Message-ID: <000501bfb596$b9e75290$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 In-Reply-To: <1000412145336.ZM12301@candle.brasslantern.com> Importance: Normal > > The change went in in 6002. It was followed in 6003 by a > change to allow > a leading double backslash to escape the delimiter. So all > you need to > do is change uses of ${foo/$bar/...} into ${foo/\\$bar/...} > to avoid the > confusion. And without 6002, there's no way to build up an anchored > pattern in a variable (which was Andrej's original complaint). > > Also, though I'm the last person to argue for keeping a > change solely for > compatibility, bash recognizes the same syntaxes. > Unfortunately, it is so inconsistent, that I really suggest to backup it. Look here: from Zsh manual (example for ${.../.../...}) foo="twinkle twinkle little star" sub="t*e" rep="spy" print ${foo//${~sub}/$rep} print ${(S)foo//${~sub}/$rep} but bor@itsrm2% foo=foo bor@itsrm2% foopat='#foo' bor@itsrm2% print ${foo/$~foopat/bar} zsh: bad pattern: #foo bor@itsrm2% print ${foo/$foopat/bar} bar bor@itsrm2% if [[ $foo == $~foopat ]]; then print yes; else print no; fi zsh: bad pattern: #foo Looking at the _arguments, there is no ~ flag either: # ... and add "same" options while (( $#sopts )); do lopts=( $lopts ${lopts/$sopts[1]/$sopts[2]} ) shift 2 sopts done So, currently - example in manual is wrong. Or, better said, it _is_ correct because #foo is invalid pattern - but, then, how _arguments work currently? Well, they work because there is no metachars in pattern (the only use is _configure). So, this is wrong anyway. - any way to fix it will lead to inconsistency - #foo will match `foo' in replacement, but not anywhere else. - nobody really expects run native bash scripts with zsh. - this "anchoring in pattern" is needed in probably 1% of all cases - forcing use of `\\' in 99%. That is weird. And if anybody needs anchoring - (#s) is there. So, my strong suggestion - let's backup it, and for the time being use (#s) in _configure (I actually do not like these "same" arguments anyway - it does not work reliably, sigh) -andrej