Você deve verificar a variável de ambiente PATH
. Veja esta resposta para uma explicação detalhada.
Where
bash
is your shell/hashbang, consistently usehash
(for commands) ortype
(to consider built-ins & keywords). When writing a POSIX script, usecommand -v
.
$ command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }
$ type foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }
$ hash foo 2>/dev/null || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }