Kevin F. Quinn wrote:
> On Mon, 5 Mar 2007 17:49:47 -0500
> Chet Ramey <[EMAIL PROTECTED]> wrote:
> 
>> Bash-Release: 3.2
>> Patch-ID: bash32-010
> 
> I'm still seeing a difference in behaviour:

Yes.  That's the difference between the undefined quoting semantics
in bash-3.1 and the defined semantics in bash-3.2.  In bash-3.2, the
quoting removes all meaning from any characters special to the regular
expression engine.

> 
> To get the 3.2 results, I expected to have to write:
> 
> [[ ${v} =~ "\^Alpha" ]] && echo match 4 || echo no match 4
> [[ ${v} =~ '\^Alpha' ]] && echo match 5 || echo no match 5

Why?  The 3.2 behavior means that the match is performed on the literal
string `\^Alpha', with the backslash and circumflex quoted to protect
them from interpretation by the regexp matching engine. That's the
difference.


> I tried reading the posix standard (well, the single-unix specification
> at opengroup.org, base definitions chapter 9 and shells & utilitis
> chapter 2) but things are not so clear to me.

Posix isn't really relevant here, because [[ is not standardized, and
the Posix utilities that match regular expressions are not shell constructs
or builtin commands.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to