Find Boolean operators help

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
COKEDUDE

Find Boolean operators help

Post by COKEDUDE »

I was reading this find guide and I saw something with the -and option that I don't think is correct. Do you need the -and option in this?

Code: Select all

$ find /mp3-collection -name 'Metallica*' -and -size +10000k 
I found my file that was bigger than 500 MB with and without the -and option.

Code: Select all

~ $ find / -iname 'ifn*' -size +500M 2>/dev/null
~ $ find / -iname 'ifn*' -and -size +500M 2>/dev/null
http://www.codecoffee.com/tipsforlinux/articles/21.html
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
DataMan

Re: Find Boolean operators help

Post by DataMan »

It looks like the acceptable format for "and" bolean in bash is "&&". My point of reference is:

http://www.gnu.org/software/bash/manual ... Constructs

-DataMan
randomizer

Re: Find Boolean operators help

Post by randomizer »

I don't think '&&' would be usable in this case, because it's not a shell script. Using '&&' here would mean that if the command preceding the ampersands completes successfully then the following command will execute. Since the following "command" is 'Metallica*' I think it will spit out errors. A quick look at the find manpage seems to indicate that '-and' is really just an unnecessary, non-POSIX compliant operator that is implied when omitted anyway.
Locked

Return to “Software & Applications”