dotfiles/dot_bashrc.d/executable_03.ENV
2022-03-13 10:49:55 +01:00

29 lines
632 B
Plaintext
Executable File

#!/usr/bin/env bash
# BINs and PATH
# extend path if directory exists and is not yet contained
# https://askubuntu.com/questions/432217/prevent-duplicate-entries-in-path
function extendPath() {
local new_dir=$1
if [ -d "$new_dir" ]; then
[[ ":$PATH:" =~ :$new_dir: ]] || PATH="$new_dir:$PATH"
fi
}
if [ -x /usr/bin/go ]; then
extendPath "$(go env GOPATH)/bin"
export GOPATH=$(go env GOPATH)
fi
if [ -d "$HOME/.cargo/bin" ]; then
extendPath "$HOME/.cargo/bin"
fi
extendPath "$HOME/bin"
extendPath "/usr/local/bin"
extendPath "$HOME/.local/bin"
export PATH
export EDITOR="vim"
export VISUAL="vim"