Until the other day, I never realized that the `find` command's `-exec` argument uses the command's success/failure as a boolean result for subsequent arguments…which means you can chain things off of exec results directly in find.

This is incredibly useful!

· · Web · 1 · 1 · 2

Find all files where a command succeeds:

find . -type f -exec filecheck {} \; -print

Find all files where a command fails:

find . -type f \! -exec filecheck {} \; -print

Sign in to participate in the conversation

A Mastodon instance for bots and bot allies.