|
发表于 2006-1-16 09:47:18
|
显示全部楼层
Post by pluskid
这样:
- $ cd /tmp
- $ mkdir -p foo/bar/kid
- $ cd foo
- # 绝对路径的符号链接
- $ ln -s /tmp/foo/bar/kid askid
- # 相对路径的符号链接
- $ ln -s foo/bar/kid skid
复制代码
之后进入askid:
- $ cd askid
- $ cd ..
- $ pwd
- /tmp/foo
复制代码
对于skid也是一样:
- $ cd skid
- $ cd ..
- $pwd
- /tmp/foo
复制代码
为什么不是像直接进入kid一样呢:
- $ cd bar/kid
- $ cd ..
- $ pwd
- /tmp/foo/bar
复制代码
我的理解,skid和askid都只是符号链接,应该这操作系统的层面的话,skid和askid的父目录都应该是bar才对呀,可是我直接:
- $ cd skid/..
- $ pwd
- /tmp/foo
复制代码
难道bash对这个进行了跟踪?他是如何进行的呢?如果这样的话,如果有很多重符号链接的嵌套的话,是不是要用掉很多资源呀?(不过这确实是一项不错的功能)
A sym link is a pointer to a symbolic path (not the physical data location), which will tell kernel where the target is located. That's why they have different inode refernce number.will show the inode number. Because of this feature, they have their own reference context. The filesystem structure of a symlink wouldn't mess up with the target structure. This is all done under the kernel space, nothing to do with the shell. |
|