[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [[ ... =~ ... ]] is broken when RHS is quoted
From: |
Chet Ramey |
Subject: |
Re: [[ ... =~ ... ]] is broken when RHS is quoted |
Date: |
Mon, 23 Jun 2008 15:12:49 -0400 |
User-agent: |
Thunderbird 2.0.0.14 (Macintosh/20080421) |
Alexis Huxley wrote:
Bash Version: 3.2
Patch Level: 39
Release Status: release
Description:
[[ ... =~ ... ]] is broken when RHS is quoted
The behavior changed, intentionally, between bash-3.1 and bash-3.2.
# As described by OP, =~ has stopped working:
lasagne$ bash -c '[[ "apple" =~ "^(apple)" ]]; echo ${BASH_REMATCH[1]}'
<--- no output!
And this is how. Quoting any part of the rhs forces it to be matched
as a string.
Patch 39, which you appear to have applied, introduces a `compat31' shell
option which you may enable to restore the bash-3.1 behavior.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/