bug-bash
[Top][All Lists]
Advanced

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

Re: Bash-3.2 Official Patch 10


From: Chet Ramey
Subject: Re: Bash-3.2 Official Patch 10
Date: Fri, 09 Mar 2007 11:39:18 -0500
User-agent: Thunderbird 1.5.0.10 (Macintosh/20070221)

Kevin F. Quinn wrote:
> On Mon, 5 Mar 2007 17:49:47 -0500
> Chet Ramey <chet.ramey@case.edu> 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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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