In the SHELL GRAMMAR section of the bash man page, the [[ expression ]] syntax is described:

When the == and != operators are used, the string to the right of the operator is
        considered a pattern and matched according to the rules described below
        under Pattern Matching.

The Pattern Matching subsection describes the familiar file name globbing syntax:

        *      Matches any string, including the null string.
        ?      Matches any single character.
        etc.

Yet when I attempt a simple match, it doesn't work:

        bash-3.00$ [[ "foo" == "foo" ]]
        bash-3.00$ echo $?
        0
        bash-3.00$ [[ "foo" == "fo?" ]]
        bash-3.00$ echo $?
        1

(I expect the second command to return 0 exit status as well, since the question mark should match the single "o" character at position 3 in "foo".)

Am I doing something wrong?


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to