Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ test(1) — Duplix 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

find(1)

TEST(1)  —  Unix Programmer’s Manual

NAME

test − condition command

SYNOPSIS

test expr

DESCRIPTION

Test evaluates the expression expr, and if its value is true then returns zero exit status; otherwise, a non zero exit status is returned. Test returns a non zero exit if there are no arguments. 

PRIMITIVES

The following primitives are used to construct expr.

−d file True if the file exists exists and is a directory. 

−f file True if the file exists and is not a directory. 

−l file True if the file exists and is a symbolic link. 

−n s1 True if the length of the string s1 is nonzero. 

−r file True if the file exists and is readable. 

−s file True if the file exists and has a size greater than zero. 

−t [ fildes ] True if the open file whose file descriptor number is fildes (1 by default) is associated with a terminal device. 

−w file True if the file exists and is writable. 

−z s1 True if the length of string s1 is zero. 

n1 −eq n2 True if the integers n1 and n2 are algebraically equal. 

n1 −ge n2 True if integer n1 is greater than or equal to n2. 

n1 −gt n2 True if integer n1 is greater than n2. 

n1 −le n2 True if integer n1 is less than or equal to n2. 

n1 −lt n2 True if integer n1 is less than n2. 

n1 −ne n2 True if integer n1 is not equal to n2.  Any of the comparisons −ne, −gt, −ge, −lt, or −le may be used in place of −eq. 

s1 True if s1 is not the null string. 

s1 = s2 True if the strings s1 and s2 are equal. 

s1 != s2 True if the strings s1 and s2 are not equal. 

OPERATORS

These primaries may be combined with the following operators:

!  Unary negation operator

−a Binary and operator

−o Binary or operator

( expr ) parentheses for grouping. 

−a has higher precedence than −o.  Note that all the operators and flags are separate arguments to test.  Note also that parentheses are meaningful to the Shell and must be escaped. 

SEE ALSO

sh(1), find(1)

INTEGRATED SOLUTIONS 4.3 BSD  —  October 26, 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026