Can I make `find` return non-0 when no matching files are found?

find /tmp -name something | grep .

The return status will be 0 when something is found, and non-zero otherwise.

EDIT: Changed from egrep '.*' to the much simpler grep ., since the result is the same.

Leave a Comment