A useful bash function that checks for command availability; if not present abort with an error message.
#!/usr/bin/env bash
# support function to check for command dependencies
function check_deps
{
DEPENDENCIES="curl git"
deps_ok=YES
for dep in $DEPENDENCIES
do
if ! $(which $dep &>/dev/null); then
echo "* ${dep} not found!"
deps_ok=NO
fi
done
if [[ $deps_ok == NO ]]; then
echo "Please install the missing dependencies and try again."
echo "Aborting!"
exit 1
else
return 0
fi
}
check_deps