开发者

How to run a program without specifying the full path?

开发者 https://www.devze.com 2023-01-03 05:51 出处:网络
How come when I type \"rails\", it won\'t work... but when I type \"/var/lib/gems/1.8/bin/rails\" it will work? How do I bind it so that I don\'t have to ty开发者_如何学Gope the full path everytime?Yo

How come when I type "rails", it won't work... but when I type "/var/lib/gems/1.8/bin/rails" it will work? How do I bind it so that I don't have to ty开发者_如何学Gope the full path everytime?


You need to edit your $PATH environmental variable.

For example, in your .bashrc:

export PATH=$PATH:/var/lib/gems/1.8/bin

Alternatively, you can use an alias, in your .bashrc:

alias rails=/var/lib/gems/1.8/bin/rails

Or you could even put the rails binary (or a symlink) to one of the directories listed in your $PATH. To see those directories, type echo $PATH.


You can create a soft link:

ln -s /var/lib/gems/1.8/bin/rails /usr/local/bin

Then you can run rails directly.

0

精彩评论

暂无评论...
验证码 换一张
取 消