Comment by gjvc
10 hours ago
bad example in the article:
export PATH="$PATH:$HOME/.local/bin/"
better:
export PATH="$HOME/.local/bin/:$PATH"
10 hours ago
bad example in the article:
export PATH="$PATH:$HOME/.local/bin/"
better:
export PATH="$HOME/.local/bin/:$PATH"
Afaik it's habit to give system paths precedence so a malicious script can't shadow e.g. sudo and steal your password, escalating a local file write into root
Otoh, if you don't put your local path first, you can't override system binaries that you want to override.
Also, if something can write into your path, it can probably write to your shell config and/or the environment variables.
Why would you want to override system binaries
2 replies →
All sorts of utilities push themselves to the front of path: uv, mise, asdf, python virtual environments, nix shell, etc.
It is a theoretically nice ideal that fails immediately when you want project specific overrides.
That’s not true with mise. You can add something to the front of PATH in front of mise bins and mise will respect that.
AFAIK it's habit to allow your scripts to override system ones, so you can customize behavior.
I've always seen home dir, homebrew, etc prepending to PATH.
That's important only for the people that add relative names (like '.') to their path.
Most people know better.
by that time it's too late and should have been prevented appearing on the host much earlier