为什么 bash 无法在 /usr/local/bin 中创建符号链接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47189213/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is bash failing to create a symbolic link in /usr/local/bin?
提问by Kevin Mangal
Attempting to create a symbolic link for the subl command so that I can open flies in Sublime Test 3 from the terminal. However, it fails to find the /usr/local/bin directory, even though it is in my path.
尝试为 subl 命令创建符号链接,以便我可以从终端在 Sublime Test 3 中打开苍蝇。但是,它无法找到 /usr/local/bin 目录,即使它在我的路径中。
$ ln -s /D/ProgramsD/SublimeText3/subl /usr/local/bin/subl
ln: failed to create symbolic link '/usr/local/bin/subl': No such file or directory
回答by janos
ln: failed to create symbolic link '/usr/local/bin/subl': No such file or directory
ln: 未能创建符号链接 '/usr/local/bin/subl': 没有那个文件或目录
This error can happen when one of the parent directories of /usr/local/bin/subl
don't exist.
当 的父目录之一/usr/local/bin/subl
不存在时,可能会发生此错误。
Create them with:
创建它们:
mkdir -p /usr/local/bin
However, it fails to find the
/usr/local/bin
directory, even though it is in my path.
但是,它无法找到该
/usr/local/bin
目录,即使它在我的路径中。
As the output of ls -ld /usr/local/bin
reveals,
indeed there is no such directory.
The fact that the directory is on your PATH
is irrelevant,
because being on the PATH
doesn't imply that a directory actually exists.
In your example it doesn't exist, you need to create it.
正如输出ls -ld /usr/local/bin
显示的那样,确实没有这样的目录。目录在您的PATH
位置这一事实无关紧要,因为在 上PATH
并不意味着目录确实存在。在您的示例中它不存在,您需要创建它。