Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OPERATORS
- Listed in order of decreasing precedence:
- ( expr )
- Force precedence. Since parentheses are special to the shell, you will normally need to quote them.
- Many of the examples in this manual page use backslashes for this purpose: `(...)' instead of
- `(...)'.
- ! expr True if expr is false. This character will also usually need protection from interpretation by the
- shell.
- -not expr
- Same as ! expr, but not POSIX compliant.
- expr1 expr2
- Two expressions in a row are taken to be joined with an implied -a; expr2 is not evaluated if expr1 is
- false.
- expr1 -a expr2
- Same as expr1 expr2.
- expr1 -and expr2
- Same as expr1 expr2, but not POSIX compliant.
- expr1 -o expr2
- Or; expr2 is not evaluated if expr1 is true.
- expr1 -or expr2
- Same as expr1 -o expr2, but not POSIX compliant.
- expr1 , expr2
- List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the
- list is the value of expr2. The comma operator can be useful for searching for several different types
- of thing, but traversing the filesystem hierarchy only once. The -fprintf action can be used to list
- the various matched items into several different output files.
- Please note that -a when specified implicitly (for example by two tests appearing without an explicit operator
- between them) or explicitly has higher precedence than -o. This means that find . -name afile -o -name bfile
- -print will never print afile.
- #include <stdio.h>
- int main (int argc, char **argv) {
- printf("THIS IS PGM1. I RETURN FALSE.n");
- return 1;
- }
- #include <stdio.h>
- int main (int argc, char **argv) {
- printf("THIS IS PGM2. I RETURN TRUE.n");
- return 0;
- }
- lalev@dragonfly:~/example10$ ls -l
- total 32
- -rwxrwxr-x 1 lalev lalev 8296 Jan 18 12:16 pgm1
- -rw-rw-r-- 1 lalev lalev 112 Jan 18 12:16 pgm1.c
- -rwxrwxr-x 1 lalev lalev 8296 Jan 18 12:16 pgm2
- -rw-rw-r-- 1 lalev lalev 111 Jan 18 12:16 pgm2.c
- -rw-rw-r-- 1 lalev lalev 0 Jan 17 23:10 test1
- lalev@dragonfly:~/example10$ find . -exec ./pgm1 ; -o -exec ./pgm2 ; -print
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- .
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- ./pgm1.c
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- ./pgm1
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- ./pgm2
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- ./test1
- THIS IS PGM1. I RETURN FALSE.
- THIS IS PGM2. I RETURN TRUE.
- ./pgm2.c
- lalev@dragonfly:~/example10$
Add Comment
Please, Sign In to add comment