How to tell if the output of the "find" command is empty?

Viewed 20616

I want to return an exit status of 0 if the output is empty and 1 otherwise:

find /this/is/a/path/ -name core.*
5 Answers

I am using this:

if test $(find $path -name value | wc -c) -eq 0
    then
     echo "has no value"
     exit
else
   echo "perfect !!!"
fi 
Related