fix: add directories to PATH only if not present already
This commit is contained in:
parent
44a6ca8350
commit
64f2783270
3 changed files with 14 additions and 3 deletions
|
@ -2,10 +2,15 @@
|
|||
[[ $- != *i* ]] && return
|
||||
|
||||
# == Add personal bin directory to PATH
|
||||
if [ -d ${HOME}/.local/bin ]; then
|
||||
if ! [[ "${PATH}" =~ "${HOME}/.local/bin" ]]; then
|
||||
export PATH=${HOME}/.local/bin:${PATH}
|
||||
fi
|
||||
|
||||
# == Add custom scripts directory to PATH
|
||||
if ! [[ "${PATH}" =~ "${HOME}/.local/scripts" ]]; then
|
||||
export PATH=${HOME}/.local/scripts:${PATH}
|
||||
fi
|
||||
|
||||
export XDG_CONFIG_HOME=${HOME}/.local/config
|
||||
export XDG_DATA_HOME=${HOME}/.local/share
|
||||
export XDG_CACHE_HOME=${HOME}/.local/cache
|
||||
|
|
|
@ -5,7 +5,10 @@ if [ -f "${HOME}/.local/software/go/bin/go" ]; then
|
|||
export GOPATH=${XDG_DATA_HOME}/go
|
||||
export GOROOT=${HOME}/.local/software/go
|
||||
export GOBIN=${HOME}/.local/goblin
|
||||
export PATH=${PATH}:${GOBIN}
|
||||
|
||||
if ! [[ "${PATH}" =~ "${GOBIN}" ]]; then
|
||||
export PATH=${GOBIN}:${PATH}
|
||||
fi
|
||||
|
||||
if ! [ -d "${GOPATH}" ]; then
|
||||
mkdir ${GOPATH}
|
||||
|
|
|
@ -2,8 +2,11 @@ if [[ -d "$HOME/.local/software" ]]; then
|
|||
for dir in ${HOME}/.local/software/*; do
|
||||
dir=${dir:A}
|
||||
if [[ -d "$dir/bin" ]]; then
|
||||
if ! [[ "${PATH}" =~ "$dir/bin" ]]; then
|
||||
export PATH="$dir/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
unset dir
|
||||
|
|
Loading…
Reference in a new issue