晦涩Unix找到命令语法的理解 [英] obscure Unix find command syntax understanding

查看:118
本文介绍了晦涩Unix找到命令语法的理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  find需要帮助理解这个复杂的Unix  find 命令和它的操作。 \(\!-user xx -exec chown -xx'{}'+ -false \)-o \ 
\(\!-group root -exec chgrp - root'{ ('+ \)-o \
\(!-perm 700 -exec chmod-700'{}'+ -exec false \; \)
-false 谓词的用途。我猜我混合了GNU和非GNU find 语法

解决方案

对于 -o ,这里用来防止短路。


  • 如果用户不是xx使其成为xx

  • 如果group不是root用户,则将其设置为root

  • 所有权限。


    每个命令由 -o 分开,并由 false ,这样它们全部应用于每个项目。

    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

    解决方案

    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.

    这篇关于晦涩Unix找到命令语法的理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆