This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.
Last Updated: 2024-11-21
Use command -v
in an if statement
#!/usr/bin/env bash
if command -v rg; then
rg ...
else
echo "Dependencies: ripgrep missing"
echo "(on macos): brew install ripgrep"
fi