[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Despite text in gnu bash manual, quote removal appears to be perform
From: |
Chet Ramey |
Subject: |
Re: Despite text in gnu bash manual, quote removal appears to be performed on case pattern |
Date: |
Tue, 12 Dec 2006 15:01:18 -0500 |
User-agent: |
Thunderbird 1.5.0.8 (Macintosh/20061025) |
Stahlman Family wrote:
> Mingw (Msys) Bash 2.04.0(1)-release
> Microsoft Windows XP Home Edition Version 2002 Service Pack 2
>
>
> Perhaps I'm misunderstanding something, but the way I read the manual
> text on the case command, if anything is printed in the example below,
> it would be "2", since if the quotes around " foo bar " are not removed
> in the case pattern, then the first case is testing the string
> <space>foo<space>bar<space>
> against
> <double-quote><space>foo<space>bar<space><double-quote>
Not exactly. Strict quote removal is not performed. The behavior of
quoted characters is as in pattern matching: quoted characters match
themselves, even characters are have special meaning in pattern matching.
There is some internal process of turning, for instance, " foo bar "
into \ \f\o\o\ \b\a\r\ , but that is not the same as quote removal.
That becomes more clear when the pattern to be quoted is "*": quote
removal would turn that into * rather than \*, so you would not be able
to use "*" to match a literal * if quote removal were performed.
Posix is, as usual, more verbose about this than the bash manual page.
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/