Comment by samatman
6 years ago
This is clever given what we have, but it seems like the wrong solution to the problem.
I already have a PATH order. What would be nice is if typing say `sc` gave me the first `sc` program, but typing `,sc` gave me the one after that.
This would generalize, so if I were stuck with cough several pythons I could call them with `python`, `,python`, `,,python` and so forth.
This would be a shell-level patch but surely not an impossible one.
Ironically, the one person whose workflow this would clobber is the one who wrote this blog post!
You could write a script called, say, "," that does this. ", sc" could invoke the second "sc" command in your $PATH, and ",, sc" could invoke the third. (What to do if there's only one "sc" in $PATH is left as an exercise.)
Pythons (AFAIK?) Are aliased under two levels of their version, so you should be able to run python, python3, and python3.8 (or whatever). I suspect that you can also do something nasty with symlinks to extend that further into virtual environments, but I've never tried it.
Please cover your mouth when you cough.
Your solution requires shell support and is incompatible with previous code, while the author’s solution works today.
Who has the wrong solution now?
Software can be bad.
that would require one to keep in mind all the $PATH values and their order, which doesn't sound fun.
I'd say it only requires you to keep in mind "crap, that's right, I installed another `sc`, the one I want is `,sc` now", and only for the few name collisions you have to deal with.
A good shell like fish could provide the full path name as a hint for any use of ,