2015-01-13 16:37:58 +01:00
|
|
|
# adapted based on https://github.com/necolas/dotfiles/blob/master/shell/bash_paths
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2015-01-13 16:37:58 +01:00
|
|
|
# Directories to be prepended to PATH
|
|
|
|
declare -a dirs_to_prepend=(
|
|
|
|
"/usr/local/sbin"
|
|
|
|
"/usr/local/bin" # Ensure that this bin always takes precedence over `/usr/bin`
|
2016-05-02 00:43:41 +02:00
|
|
|
"$HOME/.bin"
|
2015-01-13 16:37:58 +01:00
|
|
|
)
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2015-01-13 16:37:58 +01:00
|
|
|
# Directories to be appended to PATH
|
|
|
|
declare -a dirs_to_append=(
|
|
|
|
"/usr/bin"
|
|
|
|
"$(brew --prefix coreutils)/libexec/gnubin" # Add brew-installed GNU core utilities bin
|
|
|
|
"$(brew --prefix)/share/npm/bin" # Add npm-installed package bin
|
2016-05-02 00:43:41 +02:00
|
|
|
"$HOME/.rvm/bin"
|
2015-01-13 16:37:58 +01:00
|
|
|
)
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2015-01-13 16:37:58 +01:00
|
|
|
# Prepend directories to PATH
|
|
|
|
for index in ${!dirs_to_prepend[*]}
|
|
|
|
do
|
|
|
|
if [ -d ${dirs_to_prepend[$index]} ]; then
|
|
|
|
# If these directories exist, then prepend them to existing PATH
|
|
|
|
PATH="${dirs_to_prepend[$index]}:$PATH"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Append directories to PATH
|
|
|
|
for index in ${!dirs_to_append[*]}
|
|
|
|
do
|
|
|
|
if [ -d ${dirs_to_append[$index]} ]; then
|
|
|
|
# If these bins exist, then append them to existing PATH
|
|
|
|
PATH="$PATH:${dirs_to_append[$index]}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
unset dirs_to_prepend dirs_to_append
|
2014-11-03 17:40:13 +01:00
|
|
|
|
2015-07-21 01:15:25 +02:00
|
|
|
export PATH
|
|
|
|
|
|
|
|
# define CDPATHs which are autocompleted from when doing cd
|
|
|
|
export CDPATH=$CDPATH:~/Code:~/Projects
|