Hi,
On Wednesday, 2018-05-02 15:23:10 +0200, Tomas Orsava wrote:
Does anyone see a reason not to prioritize ~/.local/bin over
/usr/bin?
Many have argued one way or another.
Here is what I do, sourcing in a .zshrc (or whatever-shell-rc), which
gives me selective control to override certain commands by placing an
identical named script or symlink in $HOME/mytopbin/ and all other
whatever-named scripts go into $HOME/bin/ and any executable in
~/.local/bin does not accidentally get in the way. If need be I can
symlink ~/.local/bin/foo to ~/mytopbin/foo or have a script that
temporarily changes order.
A further advantage is, that the hand full of overrides don't get out of
sight and once a newer or to be used version is installed via RPM can
easily be removed. Or symlinks be changed pointing to other locations.
Similar to the alternatives mechanism.
I prefer a situation where ~/.local/bin *not* being prioritized yields
problems which I could temporarily or permanently solve as I like, than
the other way 'round that a prioritized ~/.local/bin suddenly makes
things wreak havoc and I wouldn't know why.
This ensures that the paths actually are placed where I desire and don't
end up as arbitrary duplicates:
# Prepend to PATH.
if [ -d "$HOME/mytopbin" ]; then
xPF="$HOME/mytopbin"
PATH="${PATH//:$xPF:/:}"
PATH="${PATH/%:$xPF/}"
PATH="${PATH/#$xPF:/}"
PATH="$xPF:$PATH"
fi
# Append to PATH.
if [ -d "$HOME/bin" ]; then
xPF="$HOME/bin"
PATH="${PATH//:$xPF:/:}"
PATH="${PATH/%:$xPF/}"
PATH="${PATH/#$xPF:/}"
PATH="$PATH:$xPF"
fi
if [ -d "$HOME/.local/bin" ]; then
xPF="$HOME/.local/bin"
PATH="${PATH//:$xPF:/:}"
PATH="${PATH/%:$xPF/}"
PATH="${PATH/#$xPF:/}"
PATH="$PATH:$xPF"
fi
Maybe helps.
Eike
--
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Care about Free Software, support the FSFE
https://fsfe.org/support/?erack