1

I know that using find . -exec <command> returns all of the files which return a success condition for that command. How do I make it so that I can find all things which have errors?

My basic use case is that I'm trying to find files which fail a basic syntax check. If I were looking for files which were valid PHP, I would do something like

find . -exec php -l {} \; -print.

How do I get the opposite of that list?

1

You can use the ! or -not option to invert the truth of the next test. So, for the example you give, it would be

find . ! -exec php -l {} \; -print

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.