Created
September 6, 2014 12:10
-
-
Save gubatron/1eb077a1c5fcf510e8e5 to your computer and use it in GitHub Desktop.
check if command exists (linux, mac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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