V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yangyaofei
V2EX  ›  程序员

chmod a-x / 作死成功.....

  •  
  •   yangyaofei ·
    yangyaofei · 2016-07-01 23:12:51 +08:00 · 3865 次点击
    这是一个创建于 2856 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有个脚本设置网页权限的....最后去掉所有非目录的 x 权限

    find $PWD | xargs ls -dl | grep ^- | awk '{print $9}' | xargs chmod a-x
    

    本来在 shell 里面执行是用的PWD,结果被我直接复制到执行脚本里了

    然而,那个脚本是用一个 daemon 在后台执行的....daemon 的PWD/

    本来测试都没问题了,准备重启下服务器愉快的玩耍了,然后就各种懵逼了.......


    PS:那台机器周末准备用映像重新刷了.....断断续续弄了一周了都......本来今天就没问题了......

    4 条回复    2016-07-02 03:27:46 +08:00
    cxbig
        1
    cxbig  
       2016-07-01 23:39:58 +08:00
    这命令不是用一个 find 就搞定了么。。。。
    find . -type f -d 1 -exec chmod a-x {} \;
    arakashic
        2
    arakashic  
       2016-07-01 23:51:51 +08:00
    LZ 你也列出非目录何苦些这么长。 find $PWD -not -type d -exec chmod a-x {} \;就好了。
    yangyaofei
        3
    yangyaofei  
    OP
       2016-07-02 00:45:35 +08:00 via Android
    @cxbig
    @arakashic 不太会这些命令………😂
    msg7086
        4
    msg7086  
       2016-07-02 03:27:46 +08:00   ❤️ 1
    Google 第一个结果就是:

    chmod -R -x+X *

    何必用 find 。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1561 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:24 · PVG 01:24 · LAX 10:24 · JFK 13:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.