Oi vey.

Is that the only thing that will be affected by shopt -s compat31?
Or perhaps that shopt needs to be a bit more specific.



> So your example would have worked with "shopt -s compat31".
> 


>From the file COMPAT:

33. Bash-3.2 adopts the convention used by other string and pattern matching
    operators for the `[[' compound command, and matches any quoted portion
    of the right-hand-side argument to the =~ operator as a string rather
    than a regular expression.


...
Other string operators?  What other ones operate this way?

This is what I'm referring to:

a="hi"
if [[ "hi" == "$a" ]]; then echo "this matches"; fi
if [[ 'hi' == '$a' ]] then echo "this doesn't"; fi

I would prefer this work:

a="h."

if [[ "hi" =~ "$a" ]];....

That would make "sense" though I'm not sure what other string operators we
are trying to be consistent with.

Foolish consistency is the hobgoblin of small minds.


Reply via email to