8 ms·
If you don't care for maximum POSIX compatibility, i.e. your script is bash-specific, it's better to use "hash", which is going to ignore aliases (but not funct
by temo4ka 7y ago
If you don't care for maximum POSIX compatibility, i.e. your script is bash-specific, it's better to use "hash", which is going to ignore aliases (but not functions) and also has the benefit of caching the command for further use.
hash foo &>/dev/null || { echo "foo command not found blabla..." >&2; exit 1; }
more info:
https://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script https://stackoverflow.com/questions/592620/how-to-check-if-a...