sh/path (292 bytes)
1 # Three methods here: 2 3 if hash ls >/dev/null 2>&1; then 4 echo "ls is available" 5 fi 6 7 for name in ls grep sed awk; do 8 if ! hash "$name" >/dev/null 2>&1; then 9 echo "FAIL: Missing command '$name'" 10 exit 1 11 fi 12 done 13 14 if command -v sed >/dev/null 2>&1; then 15 echo "sed is available" 16 fi 17