Browse Source

zshrc: More flexible way to configure PATH variable

Add `bin` folder to execute scripts globally
master
Nick Plekhanov 9 years ago
parent
commit
2570e6272c
  1. 34
      shell/zshrc

34
shell/zshrc

@ -1,9 +1,37 @@
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Explicitly configured $PATH variable
export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/"
# export MANPATH="/usr/local/man:$MANPATH"
# Directories to be prepended to $PATH
declare -a dirs_to_prepend
dirs_to_prepend=(
"/usr/bin"
"/usr/local/sbin"
"/usr/local/git/bin"
"/usr/local/"
"/usr/local/mysql/bin"
"/sw/bin/"
"$HOME/dotfiles/bin"
"$HOME/bin"
"$HOME/.rvm/bin"
"$(brew --prefix ruby)/bin"
"$(brew --prefix coreutils)/libexec/gnubin" # Add brew-installed GNU core utilities bin
"$(brew --prefix)/share/npm/bin" # Add npm-installed package bin
)
# Explicitly configured $PATH
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
for dir in ${(k)dirs_to_prepend[@]}
do
if [ -d ${dir} ]; then
# If these directories exist, then prepend them to existing PATH
PATH="${dir}:$PATH"
fi
done
unset dirs_to_prepend
export PATH
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/

Loading…
Cancel
Save