LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 958|回复: 2

庆祝一下,刚才终于想出一条命令修改目录下所有非目录文件的权限的办法了

[复制链接]
发表于 2005-11-22 10:52:31 | 显示全部楼层 |阅读模式
chmod 404 `ll |grep ^-.*|sed 's/ * / /g'|cut -d' ' -f9`
发表于 2005-11-23 09:24:59 | 显示全部楼层
交流一下

  1. [No.65 09:27:14 test ]# ls -l
  2. total 0
  3. ----------  1 root root  0 2005-11-23 09:26 1
  4. ----------  1 root root  0 2005-11-23 09:26 2
  5. ----------  1 root root  0 2005-11-23 09:26 3
  6. d---------  2 root root 48 2005-11-23 09:26 4
  7. d---------  2 root root 48 2005-11-23 09:26 5
  8. d---------  2 root root 48 2005-11-23 09:26 6
  9. [No.66 09:27:24 test ]# for file in *
  10. > do
  11. > [[ -f $file ]] && chmod 404 $file
  12. > done
  13. [No.67 09:28:29 test ]# ls -l
  14. total 0
  15. -r-----r--  1 root root  0 2005-11-23 09:26 1
  16. -r-----r--  1 root root  0 2005-11-23 09:26 2
  17. -r-----r--  1 root root  0 2005-11-23 09:26 3
  18. d---------  2 root root 48 2005-11-23 09:26 4
  19. d---------  2 root root 48 2005-11-23 09:26 5
  20. d---------  2 root root 48 2005-11-23 09:26 6
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-11-23 10:03:32 | 显示全部楼层
find .  -type f --exec chmod 404 '{}' \;
这样子也可以吧?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表