zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: b='${a//"/}' and ${(e)b}
Date: Sun, 11 May 2008 17:10:30 +0100	[thread overview]
Message-ID: <20080511161029.GA4985@sc.homeunix.net> (raw)
In-Reply-To: <080510101241.ZM6894@torch.brasslantern.com>

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


  reply	other threads:[~2008-05-11 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-10 12:38 Stephane Chazelas
2008-05-10 17:12 ` Bart Schaefer
2008-05-11 16:10   ` Stephane Chazelas [this message]
2008-05-10 21:02 ` [PATCH] zmv (Was: b='${a//"/}' and ${(e)b}) Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080511161029.GA4985@sc.homeunix.net \
    --to=stephane_chazelas@yahoo.fr \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).