选择在bash一个不同的可执行 [英] Choosing a different executable in bash

查看:110
本文介绍了选择在bash一个不同的可执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想运行制作来生成它总是使用一些太阳可执行制作位于
的/ usr / local / bin目录/作,而不是使用G​​NU make可在的/ usr / sfw / bin中/使用gmake

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆