Skip to content

Commit

Permalink
Paths are now no longer duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
craveytrain committed Jan 6, 2012
1 parent f336517 commit 158e617
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions system/functions/path_remove
@@ -0,0 +1,6 @@
# append an entry to PATH if it is a dir, and not already in path.
path_remove() {
if [[ ":$PATH:" == *":$1:"* ]]; then
PATH="$(echo $PATH | sed -e 's|'$1'||g' -e 's|::|:|g' -e 's|:$||g')"
fi
}
3 changes: 2 additions & 1 deletion system/functions/path_unshift
@@ -1,6 +1,7 @@
# prepend an entry to PATH if it is a dir, and not already in path.
path_unshift() {
if [ -d "$1" ] ; then
PATH="$1:$(echo $PATH | sed -e 's|/usr/local/bin||g' -e 's|::|:|g' -e 's|:$||g')"
path_remove $1
PATH="$1:$PATH"
fi
}

0 comments on commit 158e617

Please sign in to comment.