On 9/17/10 8:20 PM, Linda Walsh wrote: > > > Andreas Schwab wrote: >> Linda Walsh <b...@tlinx.org> writes: >> >>> Or another disparity: C. >>> t='one two three' >>> c='one two three' >>> 1) if [[ $t == $a ]]; then echo 'Matches'; fi >>> 2) if [[ $t == "$a" ]]; then echo 'Matches'; fi >>> So, the expressions match whether or not $a is in double quotes or not >>> (single quotes would not match, as the $a would be taken literally). >> >> Set a='one * three' and try again. > ---- > Why? How would that be any different than case B4 & B5 that I already > showed?
I'm not sure you are understanding the difference between one case that does not include any special pattern characters (what you're using with ==) and one that does (what you're using with =~). Since the quoting disables the special meaning of pattern characters, how can you claim that your examples are equivalent? >>> Quoting should not disable RE matching. That's what you're asserting. You're certainly entitled to do so. Since quoting does also disable pattern matching when using ==, however, you can't use alleged inconsistency as an argument. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/