加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

unix – 如何找到圆形符号链接?

发布时间:2020-12-15 18:38:28 所属栏目:安全 来源:网络整理
导读:我正在使用HP-UX系统,我想查找是否有任何循环符号链接. 到目前为止我正在使用命令: ls -lrt `find ./ -follow -type l` 但它只在当前目录上执行ls -lrt作为结果. 我应该使用什么命令来查找系统中的所有循环符号链接? GNU find的manpage说所有POSIX发现都应
我正在使用HP-UX系统,我想查找是否有任何循环符号链接.

到目前为止我正在使用命令:

ls -lrt  `find ./ -follow -type l`

但它只在当前目录上执行ls -lrt作为结果.

我应该使用什么命令来查找系统中的所有循环符号链接?

GNU find的manpage说所有POSIX发现都应该检测文件系统循环并在这些情况下发出错误消息,我已经测试过了
find . -follow -printf ""

在GNU查找,它能够找到形式的循环./a – > ./b和./b – > ./a打印错误

find: `./a': Too many levels of symbolic links
find: `./b': Too many levels of symbolic links

(这也适用于a-> b-> c-> a)

同样,形式的循环./foo/x – > ..和./foo/a – > ./bar ./bar/b – > ./foo打印错误

find: File system loop detected; `./foo/a/b' is part of the same file system loop as `./foo'.
find: File system loop detected; `./bar/b/a' is part of the same file system loop as `./bar'.
find: File system loop detected; `./foo/x' is part of the same file system loop as `.'.

如果你想对输出做一些事情而不是读它,你需要将它从stderr重定向到stdout并将它传递给一些可以解析错误信息的脚本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读