[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: escaping ! in quoted string gives wrong result

From: Paul Jarc
Subject: Re: escaping ! in quoted string gives wrong result
Date: Fri, 18 Jun 2004 13:19:59 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

Andy Isaacson <address@hidden> 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 "$".

> The problem arises when attempting to include a literal ! in a
> double-quoted string;

Right.  So don't do that when history is enabled.  This works:
echo "foo"\!"bar"

> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]