选择在bash一个不同的可执行 [英] Choosing a different executable in bash
问题描述
当我想运行制作
来生成它总是使用一些太阳可执行制作
位于
在的/ usr / local / bin目录/作
,而不是使用GNU make可在的/ usr / sfw / bin中/使用gmake $ C $找到C>。
When I want to run make
to generate some executables it always uses the Sun make
located
at /usr/local/bin/make
rather than GNU make which can be found at /usr/sfw/bin/gmake
.
我怎么能告诉操作系统要使用GNU make,而不是Sun的?我需要以某种方式改写了路径?
How can I tell the OS to use GNU make rather than Sun's? Do I need to overwrite the path somehow?
推荐答案
有关同名的两个可执行文件,重新安排路径在 PATH
变量,因为第一场比赛将使用
For two executables named identically, reorder paths in the PATH
variable, since the first match will be used.
另外,定义你的〜/ .profile文件
或〜/ .bashrc中
文件的别名:
Otherwise, define an alias in your ~/.profile
or ~/.bashrc
file:
alias make="/usr/sfw/bin/gmake"
或函数:
make() { /usr/sfw/bin/gmake "$@"; }
请注意,是别名在交互模式下才起作用。脚本不会看到他们。使用功能,在这种情况下。
Note, that aliases work only in interactive mode. Scripts will not see them. Use functions in such case.
这篇关于选择在bash一个不同的可执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!