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

Dennis Marinus dennis at marinus.nu
Tue Jun 8 12:23:35 UTC 2010


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

Regards,
Dennis




More information about the rhelv6-beta-list mailing list