The man page for bash has this to say about the =~ operator: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  # <-- noGiven that $ is a standard RE indicator for EOL, why does the second comparison return no?
What REs can I use with =~ operator
bash;regular expression
You didn't read the man page carefully, it also said:Any part of the pattern may be quoted to force the quoted portion to be matched as a string. So the $ in your string means the literal dollar sign instead of end of string. Moving the $ from the string to make it work:$ [[ $n =~ 'llo'$ ]] && echo yes || echo noyes