You are not logged in.
Pages: 1
Is there a recommended (proper) way to create a symlink to an existing executeable?
Symlink should be in PATH to serve as an "alias/alternative" to given name.
There are some situations that I know is being handled, like java, python.
What about js, like (js24, node.js, rhino, ...)?
I'm thinking the following should serve as a pretty failsafe solution:
# ln -sf /usr/bin/rhino /usr/local/bin/jsIdeas?
Cheers,
arsene
Last edited by arsene (2017-12-06 17:47:31)
Offline
Don't do this, adjust your PATH as needed instead.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Care to elaborate?
Offline
Example, add .local/bin for things you installed using `pip install --user`:
zsh: path+="~/.local/bin"
or if you use bash: PATH="$PATH:~/.local/bin"Last edited by Mr.Elendig (2017-12-06 18:49:29)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
How does changing the PATH map js to rhino?
Offline
Because you create a symlink in your $HOME/bin or whatever?
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Which works for that user but not system wide could also be achieved by an alias.
Is the aversion to the symlink making it system wide that js25 already provides /usr/bin/js so other arch packages can assume calling js meaning calling js25?
That issue would still exist though just for that one user.
Offline
Probably my question's unclear. I'd like to make it syswide. Also the executable are already in the PATH, since those were put there by some package, just not by the name I'd like to use them. I'd like to be able to switch between variants. Something like /usr/bin/edit, but I don't want to create a symlink in /usr/bin for obvious reasons.
Is there anything under root's holy Sun why creating a symlink in /usr/local/bin wouldn't do just exactly what I've described?
Offline
Probably my question's unclear. I'd like to make it syswide.
Why? Does your machine have more than one user? If you want an alias, use an alias, not a symlink.
Offline
Probably my question's unclear. I'd like to make it syswide. Also the executable are already in the PATH, since those were put there by some package, just not by the name I'd like to use them. I'd like to be able to switch between variants. Something like /usr/bin/edit, but I don't want to create a symlink in /usr/bin for obvious reasons.
Is there anything under root's holy Sun why creating a symlink in /usr/local/bin wouldn't do just exactly what I've described?
Should be fine. It isn't the most robust way. There could be issues, but that depends on situations. What is your intent on making these symlinks? E.g., why are you aliasing rhino to js?
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
There's nothing wrong with this in general, but it's generally wrong to do it uninformed.
Potential issues:
1. a generic name up in the $PATH could ultimately shadow an actual binary of the same name down in the $PATH (js185 has /usr/bin/js which will be shadowed by your symlink)
2. some binaries check their name to adjust behavior (and typically provide various symlinks already)
3. entirely wrong way to handle an xy-problem, ie. what is the *actual* problem you're trying to solve?
Offline
Which works for that user but not system wide could also be achieved by an alias.
Is the aversion to the symlink making it system wide that js25 already provides /usr/bin/js so other arch packages can assume calling js meaning calling js25?
That issue would still exist though just for that one user.
I don't know *why* MrElendig feels user-specific PATH executables/symlinks are so superior to /usr/local/bin
I agree aliases are the way to go, for one, they will not typically be loaded into the environment of scripts etc. so if you shadow an actual command it should only do so in an interactive shell interpreter.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
One further point in favor of aliases, is that they can be system-wide if you really want them to be (put them in /etc/profile or the like). Though 2MD's question on how many users are on the machine is still relevant for whether this needs to be system-wide.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'm start to think I should ditch this idea.
If you want an alias, use an alias, not a symlink.
It's way harder to find where alias has been set and change it to something else. Also are you suggesting to add an alias in profile or adding it to each installed shell's rc file?
why are you aliasing rhino to js?
I'd like to set it as a default javascript interpreter.
1. a generic name up in the $PATH could ultimately shadow an actual binary of the same name down in the $PATH (js185 has /usr/bin/js which will be shadowed by your symlink)
Shadowing would be an issue no matter what the solution is. I'm more concerned overwriting the original binary accidentally.
Last edited by arsene (2017-12-07 01:16:26)
Offline
It's way harder to find where alias has been set and change it to something else.
That's just silly. I'm done here. symlink your heart out.
Offline
It's way harder to find where alias has been set and change it to something else.
create a dotfile .aliases.sh to keep all your aliases at one place, and source it in your .bashrc
Last edited by Docbroke (2017-12-07 03:23:04)
Arch is home!
https://github.com/Docbroke
Offline
Pages: 1