See if a Package Exists in a Bash Script
1 min read

Package exists in Bash

The simplest way to check if a commando exists is the command -v <package> command. For example, it can look like command -v brew. By using it in an if-statement, we can see if the package is installed inside of a Bash script.

if [[ $(command -v brew) ]]; then
    echo "🍺 Homebrew already installed"
fi