Skip to main content
Omit unneccessary talk around it and focus on the command
Source Link

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrepgrep '.*' 

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

If you also needEDIT: Changed from egrep '.*' to capture the output ofmuch simpler findgrep . for further processing, then Sven's answer has covered thatsince the result is the same.

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrep '.*' 

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

If you also need to capture the output of find for further processing, then Sven's answer has covered that.

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.

deleted 1 character in body
Source Link
Sven
  • 101k
  • 15
  • 188
  • 231

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrep '.*' 

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

If you also need to capture the output of find for further processing, then SvenW'sSven's answer has covered that.

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrep '.*' 

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

If you also need to capture the output of find for further processing, then SvenW's answer has covered that.

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrep '.*' 

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

If you also need to capture the output of find for further processing, then Sven's answer has covered that.

Source Link
Steven Monday
  • 14.2k
  • 5
  • 39
  • 46

Here is a one-liner that I believe does what you want:

find /tmp -name something | egrep '.*' 

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

If you also need to capture the output of find for further processing, then SvenW's answer has covered that.