Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: b='${a//"/}' and ${(e)b}
- X-seq: zsh-workers 24993
 
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
 
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
 
- Subject: Re: b='${a//"/}' and ${(e)b}
 
- Date: Sun, 11 May 2008 17:10:30 +0100
 
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
 
- In-reply-to: <080510101241.ZM6894@xxxxxxxxxxxxxxxxxxxxxx>
 
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>,	Zsh hackers list <zsh-workers@xxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
 
- References: <20080510123843.GA5560@xxxxxxxxxxxxxxx> <080510101241.ZM6894@xxxxxxxxxxxxxxxxxxxxxx>
 
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author