问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/21525727/obscure-unix-find-command-syntax-understanding