[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inconsistent regex matching with =~ between bash 3.1 and 3.2
From: |
Chet Ramey |
Subject: |
Re: Inconsistent regex matching with =~ between bash 3.1 and 3.2 |
Date: |
Wed, 11 Jul 2007 14:09:17 -0400 |
User-agent: |
Thunderbird 2.0.0.4 (Macintosh/20070604) |
Scott Carpenter wrote:
> Hi, all. I hope this report is of some use -- I'm pretty inexperienced
> at GNU/Linux and Bash so I'm afraid this is going to sound horribly
> amateurish. But I think I've found something for you. (Or I'm simply
> about to demonstrate my crude understanding of regular expressions.)
>
> I realize that regex handling has changed for the =~ operator from 3.1
> to 3.2, and I'm trying to get my head around this while fixing a script
> that has broken in 3.2. I studied this thread:
>
> http://www.nabble.com/Conditional-Regexp-matching-problem-in-3.2-t3040946.html
Please read the newest Bash FAQ, question E14. It attempts to explain
the differences and the rationale.
You can solve your problem by using a shell variable to hold the pattern,
bypassing the parsing and expansion differences in backslash handling
between bash-3.1 and 3.2.
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/