Created
January 4, 2012 21:05
-
-
Save nosrednakram/1562135 to your computer and use it in GitHub Desktop.
Simple Path Munge for shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASH PATH Munge | |
pathmunge () { | |
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then | |
if [ "$2" = "after" ] ; then | |
PATH=$PATH:$1 | |
else | |
PATH=$1:$PATH | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment