Last active
December 19, 2015 02:49
-
-
Save ccoomber/5886028 to your computer and use it in GitHub Desktop.
Bash: Add to PATH
This file contains hidden or 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
# addToPATH funciton for adding a directory to PATH. | |
# Prevents duplicate entries and ensures directory exists. | |
# $1 = Directory to add to PATH | |
addToPATH(){ | |
if [ -d "${1}" ]; then | |
case ":${PATH}:" in | |
*":${1}:"*);; #Directory already in PATH | |
*) PATH="${PATH}:${1}";; #Append directory to PATH | |
esac | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment