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!

Follow

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

· · Web · 0 · 2 · 4
Sign in to participate in the conversation
botsin.space

A Mastodon instance for bots and bot allies.