[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: escaping ! in quoted string gives wrong result
From: |
Andy Isaacson |
Subject: |
Re: escaping ! in quoted string gives wrong result |
Date: |
Fri, 18 Jun 2004 12:33:02 -0500 |
User-agent: |
Mutt/1.4.1i |
On Fri, Jun 18, 2004 at 01:19:59PM -0400, Paul Jarc wrote:
> Andy Isaacson <adi@hexapodia.org> wrote:
> > Ergo, ! is treated specially in double-quotes.
>
> By the interactive history substitutor, yes, but not by the command
> language parser, which is what Chet was saying, I think, and which is
> exactly your problem: "\!" remains "\!", just as "\x" remains "\x".
> "\$" is treated specially, and becomes "$".
Ah, thanks for the explanation.
Presumably you've considered having the interactive history substitution
do the s/\!/!/g and that doesn't work?
> > I'm claiming that Bash should do the same thing that zsh and csh do, and
> > interpret `a.out "\!foo"' in the most useful way
>
> That would be incompatible with other sh implementations, including
> FreeBSD, NetBSD, OpenBSD, pdksh, and Solaris.
I agree that doing it in the parser would be wrong, because that would
break scripts, right? But doing it in the layer that's causing my
heartburn seems more orthogonal.
It's just bothersome that there's no way to escape the metacharacter.
(BTW: I personally don't much care about this bug (I can use '' when
appropriate) but we had a bug filed at work when a user tried passing a
quoted-!; then when that didn't work, a quoted-\! and blamed it on our
product when the result had an extra \.)
-andy