Verifique se existe um determinado executável (todos os shells)

exists() { type -t "$1" > /dev/null 2>&1; }

if exists brew; then
echo
'Homebrew found!'
fi

if ! exists brew; then
echo
'Homebrew not found!'
fi