O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

test

Evaluates an expression

test expression

[ expression ]

The test utility evaluates an expression and returns a condition code indicating that the expression is either true (0) or false (not 0). You can use brackets ([]) around the expression instead of using the word test (second format).

Arguments

The expression contains one or more criteria (see the following list) that test evaluates. A -a separating two criteria is a Boolean AND operator: Both criteria must be true for test to return a condition code of true. A -o is a Boolean OR operator. When -o separates two criteria, one or the other (or both) of the criteria must be true in order for test to return a condition code of true.

You can negate any criterion by preceding it with an exclamation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required