LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   difference between "-o" and "-prune -o" ? (https://www.linuxquestions.org/questions/linux-software-2/difference-between-o-and-prune-o-597439/)

nowbegin 11-06-2007 02:29 AM

difference between "-o" and "-prune -o" ?
 

Hi all,

Here are two simple tests:
Code:

find . -name "*.txt" -o -print
and
Code:

find . -name "*.txt" -prune -o -print
The output are same with each other.
But what is the difference between them?

Thanks.



colucix 11-06-2007 03:13 AM

The main difference is that -o is a logical operator and -prune is an action. The output is the same because of the rule "if the expression contains no actions other than -prune, -print is performed on all files for which the expression is true". For a detailed explanation of the -prune usage, you can check this post of mine some time ago.


All times are GMT -5. The time now is 09:47 AM.