mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Only add ~/.local/bin to PATH if it exists
Without existence check, the `find` command prints a fail message to stderr, and leaves stdout empty. This means only the prefix `:` is appended to the `$PATH` variable. Leaving a trailing `:` in `$PATH` is however something we really don't want to be doing, as it makes the current directory get treated as a part of `$PATH`. While the `~/.local/bin` directory is generally going to exist, during installation and in some other edge cases, it might not yet be there, and we need to account for that.
This commit is contained in:
parent
62912b75ba
commit
3b5ac91ae8
|
@ -8,7 +8,9 @@
|
||||||
# Add all folders in ~/.local/bin into PATH
|
# Add all folders in ~/.local/bin into PATH
|
||||||
# Some window managers require this line to be in profile
|
# Some window managers require this line to be in profile
|
||||||
# not in .zshenv
|
# not in .zshenv
|
||||||
PATH+=":${$(find -L ~/.local/bin -type d | tr '\n' ':')%%:}"
|
if [ -d "$HOME/.local/bin" ]; then
|
||||||
|
PATH+=":${$(find -L ~/.local/bin -type d | tr '\n' ':')%%:}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d "$HOME/.local/share/pyenv/shims" ]; then
|
if [ -d "$HOME/.local/share/pyenv/shims" ]; then
|
||||||
PATH+=":$HOME/.local/share/pyenv/shims"
|
PATH+=":$HOME/.local/share/pyenv/shims"
|
||||||
|
|
Loading…
Reference in a new issue