Name

test

Synopsis

    test expression
            or
    [ expression ]

Evaluate an expression and, if its value is true, return a zero exit status ; otherwise, return a nonzero exit status. In shell scripts, you can use the alternate form [ expression ]. The brackets are typed literally and must be separated from expression. Generally, this command is used with conditional constructs in shell programs. See Chapter 4 for more information on test.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.