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
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
# == Add personal bin directory to PATH
|
# == Add personal bin directory to PATH
|
||||||
if [ -d ${HOME}/.local/bin ]; then
|
if ! [[ "${PATH}" =~ "${HOME}/.local/bin" ]]; then
|
||||||
export PATH=${HOME}/.local/bin:${PATH}
|
export PATH=${HOME}/.local/bin:${PATH}
|
||||||
fi
|
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_CONFIG_HOME=${HOME}/.local/config
|
||||||
export XDG_DATA_HOME=${HOME}/.local/share
|
export XDG_DATA_HOME=${HOME}/.local/share
|
||||||
export XDG_CACHE_HOME=${HOME}/.local/cache
|
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 GOPATH=${XDG_DATA_HOME}/go
|
||||||
export GOROOT=${HOME}/.local/software/go
|
export GOROOT=${HOME}/.local/software/go
|
||||||
export GOBIN=${HOME}/.local/goblin
|
export GOBIN=${HOME}/.local/goblin
|
||||||
export PATH=${PATH}:${GOBIN}
|
|
||||||
|
if ! [[ "${PATH}" =~ "${GOBIN}" ]]; then
|
||||||
|
export PATH=${GOBIN}:${PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ -d "${GOPATH}" ]; then
|
if ! [ -d "${GOPATH}" ]; then
|
||||||
mkdir ${GOPATH}
|
mkdir ${GOPATH}
|
||||||
|
|
|
@ -2,8 +2,11 @@ if [[ -d "$HOME/.local/software" ]]; then
|
||||||
for dir in ${HOME}/.local/software/*; do
|
for dir in ${HOME}/.local/software/*; do
|
||||||
dir=${dir:A}
|
dir=${dir:A}
|
||||||
if [[ -d "$dir/bin" ]]; then
|
if [[ -d "$dir/bin" ]]; then
|
||||||
|
if ! [[ "${PATH}" =~ "$dir/bin" ]]; then
|
||||||
export PATH="$dir/bin:$PATH"
|
export PATH="$dir/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset dir
|
unset dir
|
||||||
|
|
Loading…
Reference in a new issue