原帖由 rdcwayx 于 2010-1-4 08:03 发表
没测试过。只是给个思路
BASEPATH="/tmp"
for link in ` find $BASEPATH -type l -print `
do
realfile=`ls -l $link |cut -d ">" -f2`
if [ -f $realfile ] ; then
do something, ...
原帖由 iori809 于 2010-1-4 10:36 发表
我的思路是这样的。 用-h测试它是否是符合链接,用-e测试它是否存在。如果他是一个符号链接且又不存在了。那必然是一个死的符号链接
楼上的兄弟 思路我觉得不够严谨。你只是切那个字符串。不是从根本判断。 希 ...
原帖由 nhw_cs 于 2010-1-4 08:33 发表
seems that you dont understand exactly what 'dead link' mean here. From what I understand, dead link is refering to the link whose ultimate target is not only a link, but also itself ... se ...
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |