[0m


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



[1mNAME
     [0mtest - condition command

[1mSYNOPSIS
     test [0mexpr

[1mDESCRIPTION
     [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 returns a non zero exit if there
     are no arguments.

     The following primitives are used to construct _e_x_p_r.

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

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

     [1m-f [0mfile  true if the file exists and is not a directory.

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

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

     [1m-t [0m[ fildes ]
	      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 [0ms1    true if the length of string _s_1 is zero.

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

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

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

     s1       true if _s_1 is not the null string.

     n1 [1m-eq [0mn2
	      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




Printed 15/1/92     Revision 1.2 of 19/10/88			1






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



     [1m-o   [0mbinary _o_r operator

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

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

[1mSEE ALSO
     [0msh(1), find(1)











































Printed 15/1/92     Revision 1.2 of 19/10/88			2



[0m