From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10657 invoked from network); 11 May 2008 16:10:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 May 2008 16:10:48 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 96728 invoked from network); 11 May 2008 16:10:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 May 2008 16:10:43 -0000 Received: (qmail 921 invoked by alias); 11 May 2008 16:10:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24993 Received: (qmail 897 invoked from network); 11 May 2008 16:10:38 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 May 2008 16:10:38 -0000 Received: from mail.o2.co.uk (sidious.london.02.net [82.132.130.152]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5042380ED172 for ; Sun, 11 May 2008 18:10:32 +0200 (CEST) Received: from sc.homeunix.net (78.105.216.138) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 480CEB800440816F; Sun, 11 May 2008 17:10:30 +0100 Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1JvE86-0001N9-0t; Sun, 11 May 2008 17:10:30 +0100 Date: Sun, 11 May 2008 17:10:30 +0100 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: b='${a//"/}' and ${(e)b} Message-ID: <20080511161029.GA4985@sc.homeunix.net> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20080510123843.GA5560@sc.homeunix.net> <080510101241.ZM6894@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <080510101241.ZM6894@torch.brasslantern.com> User-Agent: Mutt/1.5.16 (2007-09-19) X-Virus-Scanned: ClamAV 0.91.2/7087/Sun May 11 15:06:27 2008 on bifrost X-Virus-Status: Clean On Sat, May 10, 2008 at 10:12:41AM -0700, Bart Schaefer wrote: [...] > } $ a='a"b' > } $ b='${a//"/}' > } $ echo ${(e)b} > > (etc.) > > If you use > > $ echo ${(Xe)b} > > Then you'll see that zsh burps "parse error" on nearly every one of those > expressions. Without the (X) flag the error is silently ignored and the > expansion returns nothing. (Perhaps zmv should use (X).) > > Now, as to why it's hard to quote a double quote within a // replacement > when using the (e) flag, I'm not sure what to say except that the parsing > rules for all those nested levels of sometimes-implicit quoting get a bit > arcane. > > } How would I do? > > $ c='"' > $ b='${a//$c/}' > $ print ${(Xe)b} > > Which does work for zmv: Hi Bart, yes, that's what I had eventually found out as well (here's the comp.unix.shell discussion that started it: http://groups.google.com/group/comp.unix.shell/msg/df86a6f26b8ed168) I now also find that b='${a//"\""/}' works. That doesn't sound quite right though. -- Stéphane