Guest User

Untitled

a guest
Jan 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. OPERATORS
  2. Listed in order of decreasing precedence:
  3.  
  4. ( expr )
  5. Force precedence. Since parentheses are special to the shell, you will normally need to quote them.
  6. Many of the examples in this manual page use backslashes for this purpose: `(...)' instead of
  7. `(...)'.
  8.  
  9. ! expr True if expr is false. This character will also usually need protection from interpretation by the
  10. shell.
  11.  
  12. -not expr
  13. Same as ! expr, but not POSIX compliant.
  14.  
  15. expr1 expr2
  16. Two expressions in a row are taken to be joined with an implied -a; expr2 is not evaluated if expr1 is
  17. false.
  18.  
  19. expr1 -a expr2
  20. Same as expr1 expr2.
  21.  
  22. expr1 -and expr2
  23. Same as expr1 expr2, but not POSIX compliant.
  24.  
  25. expr1 -o expr2
  26. Or; expr2 is not evaluated if expr1 is true.
  27.  
  28. expr1 -or expr2
  29. Same as expr1 -o expr2, but not POSIX compliant.
  30.  
  31. expr1 , expr2
  32. List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the
  33. list is the value of expr2. The comma operator can be useful for searching for several different types
  34. of thing, but traversing the filesystem hierarchy only once. The -fprintf action can be used to list
  35. the various matched items into several different output files.
  36.  
  37. Please note that -a when specified implicitly (for example by two tests appearing without an explicit operator
  38. between them) or explicitly has higher precedence than -o. This means that find . -name afile -o -name bfile
  39. -print will never print afile.
  40.  
  41. #include <stdio.h>
  42.  
  43. int main (int argc, char **argv) {
  44. printf("THIS IS PGM1. I RETURN FALSE.n");
  45. return 1;
  46. }
  47.  
  48. #include <stdio.h>
  49.  
  50. int main (int argc, char **argv) {
  51. printf("THIS IS PGM2. I RETURN TRUE.n");
  52. return 0;
  53. }
  54.  
  55. lalev@dragonfly:~/example10$ ls -l
  56. total 32
  57. -rwxrwxr-x 1 lalev lalev 8296 Jan 18 12:16 pgm1
  58. -rw-rw-r-- 1 lalev lalev 112 Jan 18 12:16 pgm1.c
  59. -rwxrwxr-x 1 lalev lalev 8296 Jan 18 12:16 pgm2
  60. -rw-rw-r-- 1 lalev lalev 111 Jan 18 12:16 pgm2.c
  61. -rw-rw-r-- 1 lalev lalev 0 Jan 17 23:10 test1
  62. lalev@dragonfly:~/example10$ find . -exec ./pgm1 ; -o -exec ./pgm2 ; -print
  63. THIS IS PGM1. I RETURN FALSE.
  64. THIS IS PGM2. I RETURN TRUE.
  65. .
  66. THIS IS PGM1. I RETURN FALSE.
  67. THIS IS PGM2. I RETURN TRUE.
  68. ./pgm1.c
  69. THIS IS PGM1. I RETURN FALSE.
  70. THIS IS PGM2. I RETURN TRUE.
  71. ./pgm1
  72. THIS IS PGM1. I RETURN FALSE.
  73. THIS IS PGM2. I RETURN TRUE.
  74. ./pgm2
  75. THIS IS PGM1. I RETURN FALSE.
  76. THIS IS PGM2. I RETURN TRUE.
  77. ./test1
  78. THIS IS PGM1. I RETURN FALSE.
  79. THIS IS PGM2. I RETURN TRUE.
  80. ./pgm2.c
  81. lalev@dragonfly:~/example10$
Add Comment
Please, Sign In to add comment