function debug()
{
if [ -v VERBOSE ]
then
echo "${1}" # might want to add: >2
fi
}
function has_dep()
{
unset dependency
dependency=$(command -v "${1}")
if [ -v dependency ]
then
debug "found \"${1}\": ${dependency}"
return 0
else
debug "\"${1}\": not found"
return 1
fi
}
# example:
VERBOSE=1
if has_dep curl
then
echo "we're good"
fi
if has_dep notfoundthing
then
echo "not good."
fi