The man page for
bash has this to say about the
An additional binary operator, =~, is available, with the same precedence as == and !=. When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in regex(3))
However, I'm finding that even trivial REs don't appear to work. Here is my use case example:
n='hello' [[ "$n" =~ 'llo' ]] && echo yes || echo no # <-- yes [[ "$n" =~ 'llo$' ]] && echo yes || echo no # <-- no
$ is a standard RE indicator for EOL, why does the second comparison return "no"?