Is there a list of ‘if’ switches anywhere?

Look at the Bash man page (man bash). The options are specified in the CONDITIONAL EXPRESSIONS section:

CONDITIONAL EXPRESSIONS
       Conditional expressions are used by the [[  compound  command  and  the
       test  and [ builtin commands to test file attributes and perform string
       and arithmetic comparisons.  Expressions are formed from the  following
       unary  or  binary  primaries.   If any file argument to one of the pri-
       maries is of the form /dev/fd/n, then file descriptor n is checked.  If
       the  file  argument  to  one  of  the  primaries  is one of /dev/stdin,
       /dev/stdout, or /dev/stderr, file descriptor 0, 1, or 2,  respectively,
       is checked.

       Unless otherwise specified, primaries that operate on files follow sym-
       bolic links and operate on the target of the link, rather than the link
       itself.

       -a file
              True if file exists.
       ... more options ...

It is also explained in the help:

$ help [
[: [ arg... ]
    This is a synonym for the "test" builtin, but the last
    argument must be a literal `]', to match the opening `['.

Leave a Comment