How to check if a program exists from a Bash/Shell script
You can look to use: command -v <the_command> There are also 2 other ways, that we will run through a little further down, but for now.. How to use the command if a conditional if ! command -v <the_command> &> /dev/null then echo "<the_command> could not be found" exit fi To summarize, there are 3 ways you can do this Option 1 - Using command command -v foo >/dev/null 2>&1 || { echo >&2 "foo is not installed....