Description of problem: bash 4.1 seems to have changed the way '^' character is escaped in the strings, which breaks regex compare with '^' used to match start of the line. Following prints 'match' when testing with various bash versions (EL4, EL5, F12): var='foo' ; if [[ "$var" =~ '^f' ]] ; then echo 'match'; else echo 'no match'; fi bash 4.1 reports 'no match' however. Running with 'set -x' shows: older bash versions: + var=foo + [[ foo =~ ^f ]] + echo match bash 4.1: + var=foo + [[ foo =~ \^f ]] + echo 'no match' Version-Release number of selected component (if applicable): bash-4.1.7-1.fc13 Additional info: This seems to work as a workaround: if [[ "$var" =~ ^'f' ]]
Please take a look in bash's man page, section [[ expression ]]: <snip> Any part of the pattern may be quoted to force it to be matched as a string. Older bashes work incorrectly, but it will not be fixed, because it will cause many scripts to stop working.