From 0d5afea232d5ac174e0e9ced2f8a8802b43d55f8 Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 22 Dec 2020 02:43:32 -0500 Subject: .bash_profile: Just prefix path Avoid duplicate paths since .bashrc and .bash_profile are calling each other. --- .bash_profile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to '.bash_profile') 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" -- cgit v1.2.3