home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d811 / bsh.lha / bsh / test.doc < prev    next >
Text File  |  1993-02-14  |  2KB  |  133 lines

  1.  
  2.  
  3. TEST                                TEST
  4.  
  5.  
  6. NAME
  7.      test
  8.  
  9.  
  10. SYNOPSYS
  11.      test expression
  12.  
  13.  
  14. DESCRIPTION
  15.      test evaluates logical expressions.  test returns an exit code
  16.      of 0 if the condition is true or 1 if the condition is false.
  17.      This program is used mainly as the subject of the if command in
  18.      shell scripts.
  19.  
  20.  
  21. ARGUMENTS
  22.      An expression which consists of one or more terms separated by
  23.      and/or operators.
  24.  
  25.      -a is the and operator & separates two terms.
  26.      -o is the or operator & separates two terms.
  27.  
  28.      A term is an expression enclosed in parentheses or:
  29.  
  30.      str1 relop str2    where relop is one of:
  31.      =        true if the two strings are identical
  32.     !=        true if the two strings are different
  33.  
  34.      val1 relop val2    where relop is one of:
  35.     -lt        true if val1 is less than val2
  36.     -le        true if val1 is less than or equal to val2
  37.     -eq        true if val1 is equal to val2
  38.     -ne        true if val1 is not equal to val2
  39.     -ge        true if val1 is greater than or equal to val2
  40.     -gt        true if val1 is greater than val2
  41.  
  42.      -r filename    true if file exists & you have read access
  43.      -w filename    true if file exists & you have write access
  44.      -d filename    true if file exists & is a directory
  45.      -f filename    true if file exists & is a plain file
  46.      -s filename    true if file exists & is not empty
  47.  
  48.      ! term        the negation of term
  49.  
  50.      Each operator/operand must be a separate argument separated by
  51.      white space.
  52.  
  53.  
  54. DIAGNOSTICS
  55.      test returns -1 if it encounters an error or is unable to allocate
  56.      memory, otherwise test returns 1 if the expression is false or 0 if
  57.      the expression is true.  No error messages are printed.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. NOTES
  71.      test is not a full implementation of the *NIX test utility,
  72.      and is in fact far inferior to the bsh builtin expression
  73.      evaluator.  test is mainly used in unpacking shell-archives
  74.      and is not intended for general use.
  75.      test may be made resident either by rez, by the c:Resident 
  76.      command.  Since it was linked with the Lattice cres.o module,
  77.      rez thinks it is not shareable.
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.