by Hello71 · 8y ago · 0 comments
$ a=BCD; b=.C.; [[ $a =~ $b ]]; echo $?; [[ $a =~ "$b" ]]; echo $?
otherwise, interpolating variables in regular expressions as text would require other syntax (more confusing).also, "cat -" is redundant, use "cat". this behavior is specified by POSIX.