如何优先于PATH中的一个可执行文件优先于另一个具有相同名称且位于不同PATH文件中的可执行文件 [英] How to prioritize one executable in PATH over the other that has the same name and is in a different PATH file

查看:85
本文介绍了如何优先于PATH中的一个可执行文件优先于另一个具有相同名称且位于不同PATH文件中的可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个具有相同名称的可执行文件,出于演示目的,假设可执行文件的名称为"someexecutable.exe".现在,我想在终端中执行"someexecutable.exe"时运行新版本,但它正在运行旧版本.我已经将新版本的路径添加到.profile中,我也不知道旧可执行文件的路径是在哪个PATH文件中设置的.

I have two executables, which have the same name, for demonstration purposes let's say the name of the executable is "someexecutable.exe". Now I want to run the new version when I execute "someexecutable.exe" in the terminal yet it's running the older one. I have added the path of the new version to .profile and I have no idea in which PATH file the path for the old executable is set.

一个如何设置PATH优先级,以便在存在两个具有相同名称的可执行文件时,终端运行您想要的一个.

How does one set up PATH priority so that the when two executables with the same name are present, the terminal runs the one you want.

推荐答案

按照定义的顺序搜索$ PATH变量.因此,例如,您有path1/someprogaram.exe,然后是path2/someprogram.exe,则将执行path1.

The $PATH variable are searched in the order that is defined. So for example you have path1/someprogaram.exe followed by path2/someprogram.exe then path1 will be executed.

现在,通过添加.profile进行更改后,请确保使用

Now after you make the change by adding in your .profile make sure that you load the profile using

source ~/.bashrc

或产生一个新的外壳.

这篇关于如何优先于PATH中的一个可执行文件优先于另一个具有相同名称且位于不同PATH文件中的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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