[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exclamation points in $'string'
From: |
Chet Ramey |
Subject: |
Re: Exclamation points in $'string' |
Date: |
Sun, 21 Oct 2007 14:35:56 -0400 |
User-agent: |
Thunderbird 2.0.0.6 (Macintosh/20070728) |
Lev Bishop wrote:
> Bash Version: 3.2
> Patch Level: 25
> Release Status: release
>
> Description:
> I am seeing behaviour that doesn't seem to match with the manpage.
>
> The problem is with $'strings' where there is a backslash-escaped single
> quote in the string, and somewhere later in the string there is an
> exclamation point.
>
> Behave as expected:
> $ echo $'!'
> !
> $ echo $'!\''
> !'
>
> Does not behave as expected:
> $ echo $'\'!'
> bash: !: event not found
History expansion understands only one type of quoted string -- single
quotes -- and does not allow backslash to escape the closing single
quote (which $'...' does). The escaped single quote terminates the
quoted string, and history expansion is subsequently performed.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/