I have created a symbolic link to a deeply nested directory. Using symbolic link i can move to that directory from my home directory. I want to move one directory back from the target directory but the shell comes back to the home directory.
我创建了一个指向深层嵌套目录的符号链接。使用符号链接我可以从我的主目录移动到该目录。我想从目标目录移回一个目录,但shell返回到主目录。
[root@pe1800xs ~]# pwd
/root
[root@pe1800xs ~]# mkdir -p abc/def/ghi/jkl/mno/pqr
[root@pe1800xs ~]# ln -s abc/def/ghi/jkl/mno/pqr/ xyz
[root@pe1800xs ~]# cd xyz
[root@pe1800xs xyz]# pwd
/root/xyz
[root@pe1800xs xyz]# pwd -P
/root/abc/def/ghi/jkl/mno/pqr
[root@pe1800xs xyz]# cd ..
[root@pe1800xs ~]# pwd
/root
What I want to achieve is that when I do cd..
in pqr
directory the shell should come to mno
directory.
我想要实现的是,当我在pqr目录中执行cd ..时,shell应该进入mno目录。
2 个解决方案
#1
10
You must use
你必须使用
cd -P xyz
to enter into that directory to follow the original structure of folders, then you can move as you wish because you have resolved the link to the real path.
要进入该目录以遵循文件夹的原始结构,您可以根据需要移动,因为您已经解析了指向真实路径的链接。
#2
6
You have to pass -P
option:
你必须传递-P选项:
cd -P ..
#1
10
You must use
你必须使用
cd -P xyz
to enter into that directory to follow the original structure of folders, then you can move as you wish because you have resolved the link to the real path.
要进入该目录以遵循文件夹的原始结构,您可以根据需要移动,因为您已经解析了指向真实路径的链接。
#2
6
You have to pass -P
option:
你必须传递-P选项:
cd -P ..