|
发表于 2010-2-24 11:28:13
|
显示全部楼层
原来还有好几个这种程序阿。我只想到了用循环实现。如从软链接d找到最终文件a
cunzhang@Debian:~$ ls -l
总用量 6
lrwxrwxrwx 1 cunzhang cunzhang 5 2月 24 11:18 b -> tmp/a
lrwxrwxrwx 1 cunzhang cunzhang 1 2月 24 11:18 c -> b
lrwxrwxrwx 1 cunzhang cunzhang 1 2月 24 11:18 d -> c
drwxr-xr-x 2 cunzhang cunzhang 72 2月 24 11:17 tmp
cunzhang@Debian:~$ s=d
cunzhang@Debian:~$ while [ -h $s ]; do s=`ls -l $s|awk '{print $NF}'`; done
cunzhang@Debian:~$ echo $s
tmp/a |
|