Skip to content

Instantly share code, notes, and snippets.

@lparkes
Created April 28, 2020 01:37
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 lparkes/704b205f968d2cb27472a037b7614432 to your computer and use it in GitHub Desktop.
Save lparkes/704b205f968d2cb27472a037b7614432 to your computer and use it in GitHub Desktop.
_path() {
case ":$PATH:" in
(*":$1:"*) ;;
(*) PATH="$1:$PATH" ;;
esac
export PATH
}
path() {
test x/ = "x$1" && set -- ""
test -d "$1"/bin && _path "$1"/bin
test -d "$1"/sbin && _path "$1"/sbin
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment