[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFE: request for quotes as grouping operators to work in brackets as
From: |
Jan Schampera |
Subject: |
Re: RFE: request for quotes as grouping operators to work in brackets as elsewhere. |
Date: |
Sat, 18 Sep 2010 08:14:19 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.24 (X11/20100329) |
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
Re: RFE: request for quotes as grouping operators to work in brackets as elsewhere., Linda Walsh, 2010/09/17
Re: RFE: request for quotes as grouping operators to work in brackets as elsewhere.,
Jan Schampera <=