Bash - Dependency

Bash Liste Des Attaques Ovh

About

dependency management in Bash

How To Check if a command or utility is installed

OneLiner

Example:

command -v foo >/dev/null 2>&1 || { echo "I require foo but it's not installed.  Aborting." >&2; exit 1; }

Multiple in Loop

for cmd in {mvn,jq,curl}; do
  if ! command -v ${cmd} > /dev/null; then
    >&2 echo "This script requires '${cmd}' to be installed."
    exit 1
  fi
done

Documentation / Reference







Share this page:
Follow us:
Task Runner