mirror of
https://github.com/kremalicious/dotfiles.git
synced 2024-12-22 09:13:22 +01:00
46 lines
1.2 KiB
Bash
46 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# adapted based on https://github.com/necolas/dotfiles/blob/master/shell/bash_paths
|
|
|
|
# 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`
|
|
# "$(brew --prefix node)/bin" # Add npm/yarn-installed package bin
|
|
"$(brew --prefix openssl)/bin" # Add newer OpenSSL
|
|
# "$GOPATH/bin"
|
|
# "$GOROOT/bin"
|
|
"$HOME/.bin"
|
|
# "$HOME/.rvm/bin"
|
|
)
|
|
|
|
# Directories to be appended to PATH
|
|
declare -a dirs_to_append=(
|
|
"/usr/bin"
|
|
)
|
|
|
|
# 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
|
|
|
|
export PATH
|
|
|
|
# define CDPATHs which are autocompleted from when doing cd
|
|
export CDPATH=$CDPATH:~/Code
|