I'm sorry to not answer a message directly, but I didn't get the mails
of this list during the last day - no idea why. Quoting text from the
pipermail archive.
>> After initialÄy introducing =~, Chet made it consistent with =/==
>> in a second version, means: =/== doesn't do pattern matching for parts
>> inside quotes, =~ doesn't du regexp matching for parts inside quotes.
>
> Except this isnt' true. Quoting example C:
>
> t='one two three'
> a='one two three'
> 1) if [[ $t == $a ]]; then echo 'Matches'; fi
> 2) if [[ $t == "$a" ]]; then echo 'Matches'; fi examples.
>
> The above does match. the pattern in $a matches the pattern
> in $t whether it is in quotes or not.
>
> But with =~ it is different:
> t='one two three'
> a='one t.. three'
> 3) if [[ $t =~ $a ]]; then echo 'Matches'; fi
> 4) if [[ $t =~ "$a" ]]; then echo 'SHOULD Match'; else echo 'BUG,
double quotes
> disable match'; fi
Test with a='one t?? three', i.e. use a pattern matching special
character. Or for the regex case, use NO regex special character.
Then both should behave the same:
Patter matching:
$ t="one two three"
$ a="one t?? three"
$ [[ $t = $a ]]; echo $?
0
$ [[ $t = "$a" ]]; echo $?
1
Regular expression matching:
$ t="one two three"
$ a="one t.. three"
$ [[ $t =~ $a ]]; echo $?
0
$ [[ $t =~ "$a" ]]; echo $?
1
Regards,
Jan