#!/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"