Use bash built-in hash to check if programs exist in path

This commit is contained in:
Alex Malinovich 2016-08-11 18:51:58 -07:00
commit 1b57528f14

View file

@ -66,9 +66,8 @@ DEBIAN_INSTALL="dpkg -i"
DISTRO_INSTALL="" DISTRO_INSTALL=""
# Sanity, make sure wget is in our path... # Sanity, make sure wget is in our path...
wget >/dev/null 2>/dev/null if hash wget 2>/dev/null; then
if [ $? -eq 127 ]; then echo "ERROR: This script requires wget in the path. It could also signify that you don't have the tool installed." >&2
echo "Error: This script requires wget in the path. It could also signify that you don't have the tool installed." >&2
exit 1 exit 1
fi fi
@ -209,9 +208,8 @@ if [ "${QUIET}" = "yes" ]; then
fi fi
if [ "${AUTOUPDATE}" == "yes" ]; then if [ "${AUTOUPDATE}" == "yes" ]; then
git >/dev/null 2>/dev/null if hash git 2>/dev/null; then
if [ $? -eq 127 ]; then echo "ERROR: You need to have git installed for this to work" >&2
echo "Error: You need to have git installed for this to work" >&2
cronexit 1 cronexit 1
fi fi
pushd "$(dirname "$0")" >/dev/null pushd "$(dirname "$0")" >/dev/null