[rhelv6-beta-list] =~ no longer working in bash

Farkas Levente lfarkas at lfarkas.org
Tue Jun 8 12:32:48 UTC 2010


On 06/08/2010 02:23 PM, Dennis Marinus wrote:
> On 8 jun 2010, at 14:02, Farkas Levente wrote:
> 
>> hi,
>> =~ no longer working in bash-4.1.2-2.el6. just try this little line:
>> -----------------------------
>> if [[ "abc" =~ "abc.*" ]]; then echo inside; else echo outside; fi
>> -----------------------------
>> this give "inside" on rhel-5, and up to fedora-12, but it gives
>> "outside" in rhel-6 beta.
>> imho it's a serious error since all shell script will fail which use =~ :-(
> 
> 
> According to http://tldp.org/LDP/abs/html/bashver3.html#REGEXMATCHREF
> # NOTE: As of version 3.2 of Bash, expression to match no longer quoted.
> 
> Please try
> if [[ "abc" =~ abc.* ]]; then echo inside; else echo outside; fi

it says: "Quoting not necessary, as of version 3.2 of Bash", but not
said it's a bug. and still use "" in the second and all other examples.

-- 
  Levente                               "Si vis pacem para bellum!"




More information about the rhelv6-beta-list mailing list