bug-bash
[Top][All Lists]
Advanced

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

Re: Improper parsing of ! within double quotes


From: Chet Ramey
Subject: Re: Improper parsing of ! within double quotes
Date: Mon, 14 May 2001 10:34:09 -0400

> Versions of bash tested: 1.14.7(1) 2.04.0(1)-release 2.05.0(1)-release
> Hardware: Intel i386
> Operating System: Linux 2.2.19, Linux 2.2.16
> Compiler: gcc 2.95.2
> 
> Bash can't seem to handle correctly parsing backslash characters that appear
> just before the bang (!) character, when both are enclosed in double quotes.
> 
> (skully@cryos:~)0$ echo hi!
> hi!
> (skully@cryos:~)0$ echo hi\!
> hi!
> (skully@cryos:~)0$ echo 'hi!'
> hi!
> (skully@cryos:~)0$ echo "hi!"
> bash: !": event not found
> (skully@cryos:~)0$ echo "hi\!"
> hi\!
> 
> This may be a philisophical bug, as it seems to be present in all versions
> of bash. However, neither ksh93 or tcsh seem to have the same behavior, and
> it runs counter-intuitive to how the backslash is usually parsed.

Only single quotes and backslashes can quote the history expansion character.
Since backslash is not one of the characters that is treated specially within
double quotes, backslashes before the history expansion character are not
removed in double-quoted strings.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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