Created
July 21, 2015 15:46
-
-
Save pdxjohnny/dbe759d3de2cc1ecbe66 to your computer and use it in GitHub Desktop.
Function for checking if something is in the path
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
#!/bin/bash | |
in_path () { | |
IS_IN_PATH=1 | |
if [ -n "$1" ] | |
then | |
command -v $1 >/dev/null 2>&1 || { IS_IN_PATH=0; } | |
fi | |
return ${IS_IN_PATH} | |
} | |
in_path $1 | |
IN_PATH=$? | |
echo $IN_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment