Verifique se o programa existe

if ! command -v <the_command> &> /dev/null
then
    echo "<the_command> could not be found"
    exit
fi
TechNyquist