cd到linux中的符号链接显示错误 [英] cd to symbolic link in linux shows error
问题描述
XXXXX:~/a/n1$ ln -s n1 n
XXXXX:~/a/n1$ ls
bin doc n nc.tcsh packages scripts support VERSION
XXXXX:~/a/n1$ cd n
bash: cd: n: No such file or directory
我正在创建一个指向 n1 的符号链接,即 n.现在,当我在 bash 或 shell 中执行 cd 时,我无法做到.
I am creating a sym link to n1 which is n. Now when i do a cd in bash or shell i am not able to.
缺少什么.
推荐答案
制作符号链接的方式为 ln -s target linkname
.
Making a symlink is done as ln -s target linkname
.
目标n1"在您的当前目录中不存在,但仍然会建立链接,尽管是死链接.当你在当前目录下创建子目录n1"(比如mkdir n1
),链接就不再死了.
The target "n1" does not exists in your current directory, but the link will nevertheless been made, allbeit a dead link. When you create a subdirectory "n1" in the current directory (like mkdir n1
), the link will no longer be dead.
如果您打算创建指向当前目录."的符号链接,则命令为:ln -s .n
.请注意,这将使其递归,从而使 cd n/n/n/n/
成为可能.
If you meant to make a symlink to the current directory ".", then the command is: ln -s . n
. Note that this will make it recursive, making cd n/n/n/n/
possible.
这篇关于cd到linux中的符号链接显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!