2016-10-14 21:59:34 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
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`
|
2018-11-25 17:38:26 +01:00
|
|
|
# "$(brew --prefix node)/bin" # Add npm/yarn-installed package bin
|
2017-05-07 01:19:10 +02:00
|
|
|
"$(brew --prefix openssl)/bin" # Add newer OpenSSL
|
2019-06-08 02:42:18 +02:00
|
|
|
"$(brew --prefix ruby)/bin"
|
|
|
|
"/usr/local/lib/ruby/gems/2.5.0/bin"
|
|
|
|
"$GOPATH/bin"
|
|
|
|
"$GOROOT/bin"
|
2017-05-07 01:19:10 +02:00
|
|
|
"$HOME/.bin"
|
2018-10-22 23:16:39 +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
|
|
|
# Directories to be appended to PATH
|
|
|
|
declare -a dirs_to_append=(
|
2017-06-12 01:01:30 +02:00
|
|
|
"/usr/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
|
2017-06-12 01:04:18 +02:00
|
|
|
if [ -d "${dirs_to_prepend[$index]}" ]; then
|
2015-01-13 16:37:58 +01:00
|
|
|
# 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
|
2017-06-12 01:04:18 +02:00
|
|
|
if [ -d "${dirs_to_append[$index]}" ]; then
|
2015-01-13 16:37:58 +01:00
|
|
|
# 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
|
2018-10-22 23:16:39 +02:00
|
|
|
export CDPATH=$CDPATH:~/Code
|