coreutils: test invocation

1 
1 16.3 ‘test’: Check file types and compare values
1 ================================================
1 
1 ‘test’ returns a status of 0 (true) or 1 (false) depending on the
1 evaluation of the conditional expression EXPR.  Each part of the
1 expression must be a separate argument.
1 
1    ‘test’ has file status checks, string operators, and numeric
1 comparison operators.
1 
1    ‘test’ has an alternate form that uses opening and closing square
1 brackets instead a leading ‘test’.  For example, instead of ‘test -d /’,
1 you can write ‘[ -d / ]’.  The square brackets must be separate
1 arguments; for example, ‘[-d /]’ does not have the desired effect.
1 Since ‘test EXPR’ and ‘[ EXPR ]’ have the same meaning, only the former
1 form is discussed below.
1 
1    Synopses:
1 
1      test EXPRESSION
1      test
1      [ EXPRESSION ]
1      [ ]
1      [ OPTION
1 
1    Due to shell aliases and built-in ‘test’ functions, using an
1 unadorned ‘test’ interactively or in a script may get you different
1 functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
1 test ...’) to avoid interference from the shell.
1 
1    If EXPRESSION is omitted, ‘test’ returns false.  If EXPRESSION is a
1 single argument, ‘test’ returns false if the argument is null and true
1 otherwise.  The argument can be any string, including strings like ‘-d’,
1 ‘-1’, ‘--’, ‘--help’, and ‘--version’ that most other programs would
1 treat as options.  To get help and version information, invoke the
1 commands ‘[ --help’ and ‘[ --version’, without the usual closing
1 brackets.  ⇒Common options.
1 
1    Exit status:
1 
1      0 if the expression is true,
1      1 if the expression is false,
1      2 if an error occurred.
1 

Menu