PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] question on -a -o
Date: Friday, 11 Sep 2020, 17:49:53


    > Message Posted By: Unknown
    >
    > Could you explain why the output is as such?
    > I thought since -name "t" is false, the program won't proceed to execute
    > what is on the right side of "-a"
    >
    > [@giraffe hw1]$ /c/cs323/Hwk1/fiend -L -P -L test -name "t" -a -print -o -print
    > test
    > test/test.c
    > test/test
    > test/test/test.c
    > test/linktest
    > test/linktest/sf

Adding parentheses to show precedence, EXPRESSION is

  (-name "t" -a -print) -o (-print)

Since -name "t" is always false, the left operand for -o
is false.  Thus fiend must evaluate the right operand,
which causes every filename to be printed.

--Stan-
PREV INDEX NEXT