home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 224_01 / test.hlp < prev    next >
Encoding:
Text File  |  1987-01-05  |  1.8 KB  |  58 lines

  1. NAME
  2.     test - condition command
  3.  
  4. SYNTAX
  5.     test -v expr_list
  6.  
  7. DESCRIPTION
  8.     Test evaluates the expression expr, and if its value is true then returns 
  9.     a zero exit status; otherwise, a non-zero exit status (1) is returned.  
  10.     Test returns a non-zero exit (2) if there are no arguments or a syntax 
  11.     error occurs.  To print the result of test to the standard output, use 
  12.     the -v option as the first argument on the command line.
  13.     
  14.      The following primitives are used to construct expr.
  15.  
  16.      -r file   true if the file exists and is readable.
  17.  
  18.      -w file   true if the file exists and is writable.
  19.  
  20.      -f file   true if the file exists and is not a directory.
  21.  
  22.      -d file   true if the file exists exists and is a directory.
  23.  
  24.      -s file   true if the file exists and has a size greater than zero.
  25.  
  26.      -t file   true if the file is a device type.
  27.  
  28.      -z s1     true if the length of string s1 is zero.
  29.  
  30.      -n s1     true if the length of the string s1 is non-zero.
  31.  
  32.      s1 = s2   true if the strings s1 and s2 are equal.
  33.  
  34.      s1 != s2  true if the strings s1 and s2 are not equal.
  35.  
  36.      s1        true if s1 is not the null string.
  37.  
  38.      n1 -eq n2 true if the integers n1 and n2 are algebraically equal.  
  39.            Any of the comparisons -ne, -gt, -ge, -lt, or -le may be 
  40.            used in place of -eq.
  41.  
  42.      These primaries may be combined with the following operators:
  43.  
  44.      !    unary negation operator
  45.  
  46.      -a   binary AND operator
  47.  
  48.      -o   binary OR operator
  49.  
  50.      ( expr )
  51.           parentheses for grouping.
  52.  
  53.     -a has higher precedence than -o. Notice that all the operators and flags
  54.     are separate arguments to test.  
  55.  
  56. SEE ALSO
  57.      find, expr
  58.