简体   繁体   English

创建符号链接OSX后找不到命令

[英]Command not found after creating symbolic link OSX

I've created a symbolic link: sudo ln -s ../../Applications/MAMP/htdocs/project/tools.sh /usr/local/bin/n . 我创建了一个符号链接: sudo ln -s ../../Applications/MAMP/htdocs/project/tools.sh /usr/local/bin/n The symbolic link is added to the system: lrwxr-xr-x 1 root admin 57B Jul 27 09:05 n -> ../../Applications/MAMP/htdocs/project/tools.sh . 该符号链接已添加到系统: lrwxr-xr-x 1 root admin 57B Jul 27 09:05 n -> ../../Applications/MAMP/htdocs/project/tools.sh But when I type "n" inside my terminal it says: command not found: n . 但是,当我在终端中键入“ n”时,它会显示: command not found: n What I'm doing wrong? 我做错了什么?

A relative link would be useful only from a given directory, and then only if the current directory . 相对链接仅在给定目录下才有用,然后在当前目录下才有用. (referred to as dot ) were in your PATH variable. (称为dot )位于PATH变量中。 Unless your shell initialization set that explicitly, on OSX you won't have dot in PATH . 除非您的shell初始化对此进行了明确设置,否则在OSX上, PATH不会包含

The dot may be explicit: 可能是明确的:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:.

or implicit. 或隐式。 For example, if PATH were one of the following, it would implicitly use dot : 例如,如果PATH是以下之一,则将隐式使用dot

:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
/usr/local/bin:/usr/bin:/bin::/usr/sbin:/sbin

Further reading: the discussion of PATH in POSIX 8.3 Other Environment Variables . 进一步阅读:POSIX 8.3其他环境变量PATH的讨论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM