commit 34c6073444e7ebc8b859a2369571376a3b706e22
parent 251f39dbcf62aec85ba5082661c2bbea9fa09366
Author: Chris Bracken <chris@bracken.jp>
Date: Wed, 28 Nov 2012 10:19:32 -0800
Moved path maninpulation to .paths
Diffstat:
4 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/.bashrc b/.bashrc
@@ -69,6 +69,10 @@ xterm*|rxvt*)
;;
esac
+# path additions
+if [ -f ~/.paths ]; then
+ . ~/.paths
+fi
# aliases
if [ -f ~/.aliases ]; then
. ~/.aliases
diff --git a/.paths b/.paths
@@ -0,0 +1,22 @@
+# add to path if not already there
+path_remove() {
+ PATH=`echo $PATH | sed "s:$1::;s/::/:/;s/:$//"`
+}
+
+path_prepend() {
+ path_remove "$1"
+ export PATH="$1:$PATH"
+}
+
+path_append() {
+ path_remove "$1"
+ export PATH="$PATH:$1"
+}
+
+# set PATH so it includes user's private bin if it exists
+path_prepend "$HOME/bin"
+
+# update PATH variable for use with MacPorts
+path_prepend "/opt/local/sbin"
+path_prepend "/opt/local/bin"
+path_prepend "/opt/local/libexec/gnubin"
diff --git a/.profile b/.profile
@@ -18,19 +18,6 @@ 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
-path_add "$HOME/bin"
-
-# update PATH variable for use with MacPorts
-path_add "/opt/local/sbin"
-path_add "/opt/local/bin"
-path_add "/opt/local/libexec/gnubin"
-
# start gpg-agent
if [ -f "$HOME/.gpg-agent-info" ] && kill -0 `cut -d: -f 2 "$HOME/.gpg-agent-info"` 2>/dev/null; then
. "$HOME/.gpg-agent-info"
diff --git a/.zshrc b/.zshrc
@@ -50,6 +50,11 @@ else
fi
unset color_prompt force_color_prompt
+# path additions
+if [ -f ~/.paths ]; then
+ . ~/.paths
+fi
+
# aliases
if [ -f ~/.aliases ]; then
. ~/.aliases