4 ms·
Seemingly this is just as a cheap version of namespacing or something in the event something comes out that uses the same name as a name you chose, rather than
by JulianWasTaken 7y ago
Seemingly this is just as a cheap version of namespacing or something in the event something comes out that uses the same name as a name you chose, rather than actually being about "overriding"?
Because otherwise why not just do what I assume everyone else does, and put ~/bin before everything else on your PATH?
- macintux 7y agoAs he pointed out, he’s also able to take advantage of tab completion this way, and he doesn’t risk getting the wrong command if his path is modified.
- function_seven 7y agoIt’s to avoid collisions altogether, not to prioritize the custom commands over the standard ones. For example, let’s say I have a script that improves upon the systemctl command, and I want to use it all the time and not type a bunch of characters to invoke it. I might call it “sc”, forgetting that I also use the spreadsheet calculator sometimes. If I always prefix, then “,sc” is my shortcut, and “sc” is the spreadsheet calculator.
- JulianWasTaken 7y agoGot it thanks -- that's what I was calling "namespacing" then yeah. Not a problem I've ever had, but I guess I like the solution if it's one you do often. Thanks for confirming.
- kazinator 7y agoThere isn't just the risk of a name clash between programs that you use. It's a hygiene problem: a clash that you don't know about, involving some program you don't use (or not directly). The system programs can potentially rely on each other, invoking each other in a way that relies on PATH searching, and not set PATH to a sane value when they are invoked. Your utility can accidentally shadow something and break the program whicc relies on it. In other words, setting PATH to point to ~/bin first breaks unhygienic programs which blindly inherit PATH --- which is pretty much all non-setuid programs in a Unix-like system! Setting PATH to point to your ~/bin last, on the other and, potentially breaks your programs when they call each other (in a way that relies on path searching), and are shadowed by new system programs. A fix for that is to to put ~/bin last, and ensure that all your programs refer to each other in a way that doesn't rely on PATH. E.g. prog is invoked as $bob_utils/prog.