Skip to content

Instantly share code, notes, and snippets.

@sdumetz
Last active August 29, 2015 14:15
Show Gist options
  • Save sdumetz/eec7616f00bdf5725072 to your computer and use it in GitHub Desktop.
Save sdumetz/eec7616f00bdf5725072 to your computer and use it in GitHub Desktop.
check command existence, get script dir...
### CHECK IF COMMAND IS AVAILABLE ###
command -v foo >/dev/null 2>&1
if [ $? -eq 0 ]; then
#Command found
else
#command not found
fi
###GET SCRIPT DIRECTORY ####
DIR="$( cd "$( dirname "$0" )" && pwd )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment