Skip to content

Instantly share code, notes, and snippets.

@pdxjohnny
Created July 21, 2015 15:46
Show Gist options
  • Save pdxjohnny/dbe759d3de2cc1ecbe66 to your computer and use it in GitHub Desktop.
Save pdxjohnny/dbe759d3de2cc1ecbe66 to your computer and use it in GitHub Desktop.
Function for checking if something is in the path
#!/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