From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19062 invoked from network); 10 May 2008 17:13:04 -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; 10 May 2008 17:13:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 21363 invoked from network); 10 May 2008 17:12:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 May 2008 17:12:57 -0000 Received: (qmail 23856 invoked by alias); 10 May 2008 17:12:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24989 Received: (qmail 23839 invoked from network); 10 May 2008 17:12:54 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 May 2008 17:12:54 -0000 Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by bifrost.dotsrc.org (Postfix) with ESMTP id 2A0B280ED172 for ; Sat, 10 May 2008 19:12:49 +0200 (CEST) Received: from torch.brasslantern.com ([71.116.113.54]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0K0N009XPX57HPO1@vms046.mailsrvcs.net> for zsh-workers@sunsite.dk; Sat, 10 May 2008 12:12:44 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m4AHCgif006896 for ; Sat, 10 May 2008 10:12:43 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m4AHCf8k006895 for zsh-workers@sunsite.dk; Sat, 10 May 2008 10:12:41 -0700 Date: Sat, 10 May 2008 10:12:41 -0700 From: Bart Schaefer Subject: Re: b='${a//"/}' and ${(e)b} In-reply-to: <20080510123843.GA5560@sc.homeunix.net> To: Zsh hackers list Message-id: <080510101241.ZM6894@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20080510123843.GA5560@sc.homeunix.net> Comments: In reply to Stephane Chazelas "b='${a//"/}' and ${(e)b}" (May 10, 1:38pm) X-Virus-Scanned: ClamAV 0.91.2/7083/Sat May 10 17:55:11 2008 on bifrost X-Virus-Status: Clean On May 10, 1:38pm, Stephane Chazelas 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: $ zmv -n '*"*' '${f//$c/}' mv -- a\"b ab Or you can do this: $ zmv -n '*"*' '$f:gs/"//' mv -- a\"b ab The parsing rules for :s are a lot simpler than those for ${...}.