0

I have a custom tool installed on Linux. Let's call it MyLoggingTool. which MyLoggingTool reveals it's located under ~/.local/bin/MyLoggingTool.

Now I have a build process where I also use this tool but in a different way, I have to use a version located somewhere in a relative path. I cannot prefix the toolname with a path in my scripts as this would make both processes too different.

I would like to hide the toolpath of the installed one with the toolpath to my local version. How would I do sth like that? I tried to just set a variable `called MyLoggingTool, hoping it would hide the installed toolpath, but it doesn't work.

DanDan
  • 1,038
  • 4
  • 15
  • 28
  • You can adjust the PATH variable, which lists the directories to be searched and the order in which they're to be searched – Jiří Baum Sep 13 '21 at 04:03
  • Yes, I could try that, but this is more of a temporary thing. Is there a way of doing that just for the current process? – DanDan Sep 13 '21 at 04:06
  • Yeah, each process has its own `PATH` variable – Jiří Baum Sep 13 '21 at 04:10
  • You can set the `PATH` variable separately for the build script, or for a particular window, etc. If you're familiar with Python, that's how virtualenv works – Jiří Baum Sep 13 '21 at 04:13
  • OK, so I could just try ```ùnset``` I guess. But when I do a ```env | grep MyLoggingTool```, then I actually don't get any reference to my tool, it's located in a central bin folder but not actually in my ```PATH``` variable (sorry I'm not a Linux guy...) – DanDan Sep 13 '21 at 04:13
  • 2
    Yes, the executable's name won't be in your `env`. The path to it `~/.local/bin` will be in `$PATH`. – tink Sep 13 '21 at 05:13
  • Just set the `PATH` variable inside your build script (or inside a wrapper script); then the script will use the modified path but it won't affect anything outside – Jiří Baum Sep 13 '21 at 05:51

1 Answers1

1

Ref. How to set an environment variable only for the duration of the script? and Setting environment variable for one program call in bash using env

You may alter the PATH definition specifically for your tool execution in the same mood such as:

$ PATH=~/.local/bin/MyLoggingTool:$PATH MyBuildTool
Dfaure
  • 564
  • 7
  • 26