Use easily extensible path manipulation

By using a for loop, new entries can easily be added to the PATH without
having to enter additional commands. The precedence of the entries can
also be easily adjusted by reordering the list that is iterated over.
This commit is contained in:
Fernando Schauenburg 2015-11-04 12:52:29 +01:00
parent dc2ee984a1
commit 419775ef10

View file

@ -22,17 +22,18 @@ export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
[ -z "$BACKGROUND" ] && export BACKGROUND="dark"
gnubin=/usr/local/opt/coreutils/libexec/gnubin
[ -d "$gnubin" ] && PATH="$gnubin:$PATH"
[ -d "$HOME/.dotfiles/bin" ] && PATH="$HOME/.dotfiles/bin:$PATH"
[ -d "$HOME/bin" ] && PATH="$HOME/bin:$PATH"
export PATH
# Prepend custom bin directories to PATH if they exist.
for p in /usr/local/opt/coreutils/libexec/gnubin "$HOME/.dotfiles/bin" "$HOME/bin"
do
[ -d "$p" ] && export PATH="$p:$PATH"
done
localman=/usr/local/share/man
gnuman=/usr/local/opt/coreutils/libexec/gnuman
[ -d "$localman" ] && MANPATH="$localman:$MANPATH"
[ -d "$gnuman" ] && MANPATH="$gnuman:$MANPATH"
export MANPATH
# Prepend custom man directories to MATPATH if they exist, so that we get
# correct man page entries when multiple versions of a command are available.
for p in localman=/usr/local/share/man /usr/local/opt/coreutils/libexec/gnuman
do
[ -d "$p" ] && export MANPATH="$p:$MANPATH"
done
#
# Aliases