LinuxSir.cn,穿越时空的Linuxsir!

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

求一个脚本实现这样的功能

[复制链接]
发表于 2007-5-16 12:25:49 | 显示全部楼层 |阅读模式
能找出系统在中无效的链接(含 ln & ln -s 的)
发表于 2007-5-16 16:23:33 | 显示全部楼层
sudo find / -type l -print | xargs file | grep 'broken symbolic link' | cut -f1 -d':'
回复 支持 反对

使用道具 举报

发表于 2007-5-16 21:51:24 | 显示全部楼层
find / -L -type l
根据man find 里的话:
              When the -L option is in effect, the -type predicate will always
              match against the type of the file that a symbolic  link  points
              to rather than the link itself (unless the symbolic link is bro-
              ken).
回复 支持 反对

使用道具 举报

发表于 2007-5-16 23:07:15 | 显示全部楼层
Post by lastart
find / -L -type l
              
  1.   find [-H] [-L] [-P] [path...] [expression]
  2.   find -L / -type l   
复制代码
不然出错,说 -L 选项无效.
回复 支持 反对

使用道具 举报

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

本版积分规则

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