Hide Forgot
Related to bug 652211... This expression worked on f<13, but was b0rk by removal of the cond-rmatch patch: ( echo $BASH_VERSION ; b=foo ; [[ $b-42 =~ "^$b-[0-9][0-9]\$" ]] && echo right || echo wrong ) 4.0.38(1)-release right ( echo $BASH_VERSION ; b=foo ; [[ $b-42 =~ "^$b-[0-9][0-9]\$" ]] && echo right || echo wrong ) 4.1.7(1)-release wrong So, apparently the fix is to remove the quotes. But the only way to get the trailing $ to properly match EOL is to also not escape it. ( b=foo ; [[ $b-42 =~ ^$b-[0-9][0-9]\$ ]] && echo right || echo wrong ) wrong Which still leaves some ambiguity over what purpose the $ symbol has in that context. ( b=foo ; [[ $b-42 =~ ^$b-[0-9][0-9]$ ]] && echo right || echo wrong ) right
It's not. It is parsed as expected. `$' is followed by `b' so it's variable expansion. The last `$' is followed by space ` ' so it's processed as single `$' and in Pattern Matching means match the EOL. So, no ambiguity.