Checking That a Tool Exists
A script needs jq. Which check is the most reliable way to fail early if it's missing?
jq
Choose one answer
command -v jq >/dev/null || exit 1
jq --version | grep -q jq
if [ -f /usr/bin/jq ]; then …
which jq and compare its output to an empty string with [ -z ]
which jq
[ -z ]