1 |
Ulrich Mueller wrote: |
2 |
|
3 |
> But both sides of [[ ]] aren't symmetric, in the first place: |
4 |
> |
5 |
> # When the == and != operators are used, the string to the right of |
6 |
> # the operator is considered a pattern and matched according to the |
7 |
> # rules described below under Pattern Matching. |
8 |
> |
9 |
> So there's almost never a reason for quoting the left-hand side, while |
10 |
> on the right-hand side quotes will suppress pattern matching. |
11 |
> |
12 |
> (Of course, in the example above it doesn't matter, because the string |
13 |
> doesn't contain any special characters.) |
14 |
> |
15 |
Indeed; minor addition: the above applies to [[ foo = bar* ]] as well, |
16 |
ie you don't have to use == (and most BASH scripters don't.) It's the fact |
17 |
that you're in [[ which triggers fnmatch() behaviour. |
18 |
|
19 |
-- |
20 |
#friendly-coders -- We're friendly, but we're not /that/ friendly ;-) |