Hacker News new | ask | show | jobs
by temo4ka 2432 days 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...