Ibrahim Quraish
Ibrahim Quraish

Reputation: 4099

obscure Unix find command syntax understanding

Need help in understanding this complex Unix find command and its operation:

find . \( \! -user xx -exec chown -- xx '{}' + -false \) -o    \
\( \! -group root -exec chgrp -- root '{}' + \) -o \
\( ! -perm 700 -exec chmod -- 700 '{}' + -exec false \; \)

Also, I am looking out in particular the purpose of -false predicate. I guess I mixed both GNU and non-GNU find syntax

Upvotes: 2

Views: 205

Answers (1)

perreal
perreal

Reputation: 97948

The false predicate evaluated to false for -o and it is used here to prevent short short-circuiting.

  • if user is not xx make it xx
  • if group is not root, make it root
  • if not all permissions are set for the owner, grant all permissions.

Each command is separated by -o and terminated by false so that they are ALL applied to each item.

Upvotes: 3

Related Questions