Skip to content

Instantly share code, notes, and snippets.

@gubatron
Created September 6, 2014 12:10
Show Gist options
  • Save gubatron/1eb077a1c5fcf510e8e5 to your computer and use it in GitHub Desktop.
Save gubatron/1eb077a1c5fcf510e8e5 to your computer and use it in GitHub Desktop.
check if command exists (linux, mac)
function command_exists {
#this should be a very portable way of checking if something is on the path
#usage: "if command_exists foo; then echo it exists; fi"
type "$1" &> /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment