dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 17e400b2d696e66fdcdde5c0cfd79a9a8dbb9e84
parent d6d8c60b099acf34c8dd9d04a5e0ca66180b6115
Author: Chris Bracken <cbracken@google.com>
Date:   Mon, 22 Oct 2012 13:45:01 -0700

Added path_add() func: add to path if the component is present and not already in path

Diffstat:
M.profile | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.profile b/.profile @@ -17,13 +17,18 @@ if [ -n "$BASH_VERSION" ]; then fi fi +# add to path if not already there +path_add() { + [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]] && PATH="$1:$PATH" +} + # set PATH so it includes user's private bin if it exists -[ -d "$HOME/bin" ] && PATH="$HOME/bin:$PATH" +path_add("$HOME/bin") # update PATH variable for use with MacPorts -[ -d /opt/local/sbin ] && PATH="/opt/local/sbin:$PATH" -[ -d /opt/local/bin ] && PATH="/opt/local/bin:$PATH" -[ -d /opt/local/libexec/gnubin ] && PATH="/opt/local/libexec/gnubin:$PATH" +path_add("/opt/local/sbin") +path_add("/opt/local/bin") +path_add("/opt/local/libexec/gnubin") # login message if [ -x /usr/games/fortune ]; then