[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

16.3 test: Check file types and compare values

test returns a status of 0 (true) or 1 (false) depending on the evaluation of the conditional expression expr. Each part of the expression must be a separate argument.

test has file status checks, string operators, and numeric comparison operators.

Because most shells have a built-in command by the same name, using the unadorned command name in a script or interactively may get you different functionality than that described here.

Besides the options below, test accepts a lone `--help' or `--version'. See section 2. Common options. A single non-option argument is also allowed: test returns true if the argument is not null.

16.3.1 File type tests  -[bcdfhLpSt]
16.3.2 Access permission tests  -[gkruwxOG]
16.3.3 File characteristic tests  -e -s -nt -ot -ef
16.3.4 String tests  -z -n = !=
16.3.5 Numeric tests  -eq -ne -lt -le -gt -ge
16.3.6 Connectives for test  ! -a -o



This document was generated by Jeff Bailey on December, 28 2002 using texi2html