Skip to content

Instantly share code, notes, and snippets.

@stopyoukid
Created October 6, 2015 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stopyoukid/4dce474ea6d01968d9e9 to your computer and use it in GitHub Desktop.
Save stopyoukid/4dce474ea6d01968d9e9 to your computer and use it in GitHub Desktop.
pathadd() {
echo "$1"
if [ -d "$1" ]; then
if [ ":$PATH:" != *":$1:"* ]; then
echo "export PATH=\"\$PATH:$1\"" >> ~/.bashrc
source ~/.bashrc
else
echo "$1 is already in the path"
fi
else
echo "Invalid directory: $1"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment