4 ms·
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` g
by samatman 7y 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!
- _kst_ 7y agoYou 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.)
- yjftsjthsd-h 7y agoPythons (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.
- toxik 7y agoPlease cover your mouth when you cough.
- heavenlyblue 7y agoYour solution requires shell support and is incompatible with previous code, while the author’s solution works today. Who has the wrong solution now?
- rdlw 7y agoSoftware can be bad.
- dimator 7y agothat would require one to keep in mind all the $PATH values and their order, which doesn't sound fun.
- samatman 7y agoI'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 ,