Skip to content

Instantly share code, notes, and snippets.

@morganp
Created May 10, 2011 09:54
Show Gist options
  • Save morganp/964200 to your computer and use it in GitHub Desktop.
Save morganp/964200 to your computer and use it in GitHub Desktop.
Add to bash path if not already there
pre_add_path() {
if [ -s "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$1:$PATH"
fi
}
post_add_path() {
if [ -s "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$PATH:$1"
fi
}
#Source
#http://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment