Linux 命令快捷方式变量
我对Linux一窍不通,所以这可能是一个简单的问题...
我想要这里的可执行文件:
/root/hiphop/hiphop-php/src/hphp/hphp
当我输入时运行:
hphp
如何设置?
I'm rubbish at Linux, so this is probably an easy question...
I want the executable here:
/root/hiphop/hiphop-php/src/hphp/hphp
To be run when I type:
hphp
How do I set that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
名为 PATH 的环境变量将告诉您的 shell 在哪里查找可执行文件。如果你添加这样一行:
到你的 bashrc (假设你使用的是 bash )
那么每次您在命令行上输入某些内容时,都会扫描该目录中的可执行文件。
或者,您可以从 PATH 中已有的位置添加符号链接到该文件(这可能是一个更好的主意)。
编辑:这看起来也是您通过configure/make(或类似)自己编译的程序。可能有一个名为 install 的 make 目标,您可以使用它来将文件复制到 /usr/local/sbin (或类似的东西)。不过你需要root权限。
The environment variable called PATH will tell your shell where to look for executables. If you add a line like this:
to your bashrc ( assuming you're using bash )
then that directory will be scanned for executables every time you enter something on the command line.
alternately, you could add a symlink from a location already in your PATH to that file ( which is probably a better idea ).
EDIT: also it looks like this is a program you've compiled yourself via configure/make (or similar). there is probably a make target called install which you can use to copy the file to /usr/local/sbin ( or something like that ). you will need to be root though.