[Top][All Lists]

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

history character not quoted by ""

From: Steve Summit
Subject: history character not quoted by ""
Date: Mon, 10 Feb 2003 12:39:22 -0500

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-2.05
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' 
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='powerpc-suse-linux' -DCONF_VENDOR='suse' 
-DSHELL -DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64  -I. -I/usr/include -I. 
-I./include -I./lib -I/usr/include -O2 -fsigned-char -D_GNU_SOURCE -Wall -pipe
uname output: Linux aerotwo 2.4.12 #2 Thu Oct 18 14:41:03 GMT 2001 ppc unknown
Machine Type: powerpc-suse-linux

Bash Version: 2.05
Patch Level: 0
Release Status: release

        According to both the man page and the info page,
        "Enclosing characters in double quotes preserves the
        literal value of all characters within the quotes,
        with the exception of $, `, and \."  However, if you
        use a ! character between double quotes, it appears
        to attempt to invoke a history mechanism.

        I don't know what the desired behavior is; it's possible
        that only the documentation needs fixing.  (Personally,
        though, I would prefer that history expansion not occur
        inside double quotes.)


                echo "Hello, world!"

        Observe the error message

                bash: !": event not found

        I don't have a fix (other than the obvious edit to the
        documentation, if this is desired behavior), but two
        obvious workarounds are to use single instead of double
        quotes (so long as variable and command substitution is
        not required), and to disable history entirely using set +H.

        (One obvious workaround which does *not* work is to quote
        the ! with \, since it comes through as \!, instead of !.

        A *non* obvious workaround is to not use double quotes at all!

                echo "Hello, world!"

        leads to the error message, the invocation

                echo Hello, world!

        does not.  (Obviously I don't understand csh-style history
        completion, or this discrepancy would probably not seem
        so surprising to me.)

reply via email to

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