home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man1 / if.1 < prev    next >
Encoding:
Text File  |  1975-06-26  |  1.3 KB  |  87 lines

  1. .th IF I 5/2/74
  2. .sh NAME
  3. if \*-  conditional command
  4. .sh SYNOPSIS
  5. .bd if
  6. expr command [ arg ... ]
  7. .sh DESCRIPTION
  8. .it If
  9. evaluates the expression
  10. .it expr,
  11. and if its value is
  12. true,
  13. executes the given
  14. .it command
  15. with the given arguments.
  16. .s3
  17. The following primitives are used to construct
  18. the
  19. .it expr:
  20. .s3
  21. .lp +13 13
  22. \fB\*-r\fR file    true if the file exists and is readable.
  23. .s3
  24. .lp +13 13
  25. \fB\*-w \fRfile    true if the file exists and is writable.
  26. .s3
  27. .lp +13 13
  28. s1 \fB= \fRs2    true
  29. if the strings
  30. .it s1
  31. and
  32. .it s2
  33. are equal.
  34. .s3
  35. .lp +13 13
  36. s1 \fB!= \fRs2    true
  37. if the strings
  38. .it s1
  39. and
  40. .it s2
  41. are not equal.
  42. .s3
  43. .lp +13 13
  44. \fB{ \fRcommand \fB}\fR    The bracketed command is
  45. executed to obtain the
  46. exit status.
  47. Status zero is considered
  48. .it true.
  49. The command must
  50. not
  51. be another
  52. .it if.
  53. .s3
  54. .i0
  55. These primaries may be combined with the
  56. following operators:
  57. .s3
  58. .lp +13 13
  59. \fB!\fR    unary negation operator
  60. .s3
  61. .lp +13 13
  62. \fB\*-a\fR    binary
  63. .it and
  64. operator
  65. .s3
  66. .lp +13 13
  67. \fB\*-o\fR    binary
  68. .it or
  69. operator
  70. .s3
  71. .lp +13 13
  72. \fB( \fRexpr\fB )\fR    parentheses for grouping.
  73. .s3
  74. .i0
  75. .bd \*-a
  76. has higher precedence than
  77. .bd \*-o.
  78. Notice that all the operators and flags are separate
  79. arguments to
  80. .it if
  81. and hence must be surrounded by spaces.
  82. Notice also that parentheses are meaningful
  83. to the Shell and must be escaped.
  84. .sh "SEE ALSO"
  85. sh (I), find (I)
  86. .sh BUGS
  87.