diff options
author | tdro <tdro@users.noreply.github.com> | 2020-12-22 02:43:32 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2020-12-23 01:27:54 -0500 |
commit | 0d5afea232d5ac174e0e9ced2f8a8802b43d55f8 (patch) | |
tree | 26b5879dc714d7299318d9ab4770d81951e5b192 | |
parent | 7bd85e987c52846659cfb4d4e8f3c672e17a90cb (diff) | |
download | dotfiles-0d5afea232d5ac174e0e9ced2f8a8802b43d55f8.tar.gz dotfiles-0d5afea232d5ac174e0e9ced2f8a8802b43d55f8.tar.bz2 dotfiles-0d5afea232d5ac174e0e9ced2f8a8802b43d55f8.zip |
.bash_profile: Just prefix path
Avoid duplicate paths since .bashrc and .bash_profile are calling each
other.
-rw-r--r-- | .bash_profile | 10 | ||||
-rw-r--r-- | .bashrc | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/.bash_profile b/.bash_profile index 57ed40c..aa8c294 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,6 +1,14 @@ #!/bin/bash # shellcheck disable=SC2016 +prefixPath() { + case ":$PATH:" in + *":$1:"*) true ;; + *) PATH="$1:$PATH" ;; + esac + export PATH; +} + # set xauthority path export XAUTHORITY=$HOME/.config/X11/Xauthority; @@ -24,7 +32,7 @@ PS1_SSHD='$(E=$? && [ "$E" = 0 ] || echo "$E ")\[\e[0;32m\]\W\[\e[0m\] \[\e[0;32 [ -n "$SSH_CLIENT" ] && [ "$EUID" != 0 ] && export PS1="$PS1_SSHD"; # path exports -[ -z "$BASH_PROFILE" ] && export PATH="$HOME/.local/bin:$PATH" +prefixPath "$HOME/.local/bin"; # general exports export CARGO_HOME="$XDG_CACHE_HOME/cargo" @@ -1,7 +1,7 @@ #!/bin/bash # source exports -export BASH_PROFILE=loaded && . "$HOME/.bash_profile"; +export BASH_PROFILE=1 && . "$HOME/.bash_profile"; # bail if not interactive echo $- | grep -q "i" || return; |