Bug in bash regex: doesn't recognise the line start caret
From:
Graham North
Subject:
Bug in bash regex: doesn't recognise the line start caret
Date:
Fri, 4 Nov 2011 08:31:39 -0000 (UTC)
User-agent:
SquirrelMail/1.4.8-5.el5.centos.10
Hi,
There seems to be a bug in bash regex.
It doesn't recognise the line start caret:
--Commands:
ONE="/fred"
TWO="fred/"
REGEX='^/'
echo "$ONE $TWO $REGEX"
[[ "$ONE" =~ "$REGEX" ]] && echo yes || echo no
[[ "$TWO" =~ "$REGEX" ]] && echo yes || echo no
--Result:
/fred fred/ ^/
no
no
Not sure how to proceed.
Thanks
Graham (0779 321 1967)