Skip to content

Instantly share code, notes, and snippets.

@andrewmeissner
Created March 18, 2020 16:40
Show Gist options
  • Select an option

  • Save andrewmeissner/48a00e544c79ddb2ee5d2734a42c80c1 to your computer and use it in GitHub Desktop.

Select an option

Save andrewmeissner/48a00e544c79ddb2ee5d2734a42c80c1 to your computer and use it in GitHub Desktop.
adds param to path if it isn't already in the path
#!/bin/bash
function setPath {
echo $PATH | grep -q "$1"
if [ $? -ne 0 ]; then
PATH="$PATH:$1"
fi
export PATH
}
setPath "$HOME/mybin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment