Skip to content

Instantly share code, notes, and snippets.

@dathanb
Created March 4, 2022 23:06
Show Gist options
  • Save dathanb/e3c949f9dff26bea5d8709caa5aaa13f to your computer and use it in GitHub Desktop.
Save dathanb/e3c949f9dff26bea5d8709caa5aaa13f to your computer and use it in GitHub Desktop.
Detect whether ~/bin is in the PATH
# Install to ~/bin if it's already on the path; otherwise install to /usr/local/bin
case ":$PATH:" in
*":$HOME/bin/:"*|*":$HOME/bin:"*)
INSTALL_DIR="$HOME/bin"
;;
*)
INSTALL_DIR=/usr/local/bin
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment