when I perform
find /tmp -name something
find command not find the something word under /tmp
echo $?
I get $?=0
it's OK
but how to enable Exit status diff then 0 when find command not find the something word?
|
when I perform
find command not find the something word under /tmp
I get $?=0 it's OK but how to enable Exit status diff then 0 when find command not find the something word?
| |||
feedback
|
|
Here is a one-liner that I believe does what you want:
The return status will be If you also need to capture the output of | |||
|
feedback
|
|
It's not possible. Find returns 0 if it exits successfully, even if it didn't find a file (which is a correct result not indicating an error when the file indeed doesn't exist). To quote the find manpage
Depending on what you want to achieve you could try to let find
| |||
|
feedback
|
|
It is not only | ||||
|
feedback
|