[0m


TEST(1V)	    UNIX Programmer's Manual		 TEST(1V)



[1mNAME
     [0mtest - perform tests and return status (sh only)

[1mSYNOPSIS
     test [0mexpression
     [1m[ [0mexpression [1m]

DESCRIPTION
     [0m_T_e_s_t evaluates the expression _e_x_p_r, and if its value is true
     then returns zero exit status; otherwise, a non zero exit
     status is returned.  _T_e_s_t also returns a non zero exit if
     there are no arguments.

     The following primitives are used to construct _e_x_p_r.

     [1m-r [0m_f_i_l_e   true if the file exists and is readable.

     [1m-w [0m_f_i_l_e   true if the file exists and is writable.

     [1m-x [0m_f_i_l_e   true if the file exists and is executable.

     [1m-f [0m_f_i_l_e   true if the file exists and is a regular file.

     [1m-d [0m_f_i_l_e   true if the file exists exists and is a directory.

     [1m-c [0m_f_i_l_e   true if the file exists and is a character device.

     [1m-b [0m_f_i_l_e   true if the file exists and is a block device.

     [1m-p [0m_f_i_l_e   true if the file exists and is a named pipe (see
	       _m_k_f_i_f_o(1v)).

     [1m-u [0m_f_i_l_e   true if the file exists and the setuid bit is set
	       (bit 04000 in the file mode bits).

     [1m-g [0m_f_i_l_e   true if the file exists and the setgid bit is set
	       (bit 02000 in the file mode bits).

     [1m-s [0m_f_i_l_e   true if the file exists and has a size greater
	       than zero.

     [1m-t[0m [_f_i_l_d_e_s]
	       true if the open file whose file descriptor number
	       is _f_i_l_d_e_s (1 by default) is associated with a ter-
	       minal device.

     [1m-z [0m_s_1     true if the length of string _s_1 is zero.

     [1m-n [0m_s_1     true if the length of the string _s_1 is nonzero.

     _s_1 [1m= [0m_s_2   true if the strings _s_1 and _s_2 are equal.




Printed 31/1/92     Revision 1.1 of 10/10/90			1






TEST(1V)	    UNIX Programmer's Manual		 TEST(1V)



     _s_1 [1m!= [0m_s_2  true if the strings _s_1 and _s_2 are not equal.

     _s_1        true if _s_1 is not the null string.

     _n_1 [1m-eq [0m_n_2 true if the integers _n_1 and _n_2 are algebraically
	       equal.  Any of the comparisons [1m-ne[0m, [1m-gt[0m, [1m-ge[0m, [1m-lt[0m,
	       or [1m-le [0mmay be used in place of [1m-eq[0m.

     These primaries may be combined with the following opera-
     tors:

     [1m!	       [0munary negation operator.

     [1m-a        [0mbinary _a_n_d operator.

     [1m-o        [0mbinary _o_r operator.

     [1m( [0m_e_x_p_r [1m)  [0mparentheses for grouping.

     [1m-a [0mhas higher precedence than [1m-o[0m.	Notice that all the
     operators and flags are separate arguments to _t_e_s_t.  Notice
     also that parentheses are meaningful to the Shell and must
     be escaped.

     When using the command [ the command must be followed by a
     space and the final [1m] [0mmust be given and preceded by a space.

[1mNOTES
     [0mThe command is a shell built-in.  Programs with identical
     names exist but have slightly different semantics - see
     _t_e_s_t(1).

[1mSEE ALSO
     [0m_s_h(1), _t_e_s_t(1), _e_x_p_r(1).





















Printed 31/1/92     Revision 1.1 of 10/10/90			2



[0m