I try to use binary operator to use regexpression power,
[[ wwwebhost@all =~ "^.+@.+$" ]]
do not work in bash 4.2 and works in bash 3.2
but this works in bash 4.2(drop the double quote):
[[ wwwebhost@all =~ ^.+@.+$ ]]
can anyone explain this ?
In bash 4 (actually I thought this was added in 3.2, but maybe not) quotation marks on the right side of a
=~or==operator inside[[…]]tellbashto do simple string comparison rather than regular expression matching. You might think this would not be the case with the explicit “hey, do a regular expression match!” operator=~, but it is.