Table of Contents

Bash - Command (The Builtin command command)

About

This article talks about the builtin command utility command. To know what a command means in the context of bash, see What is a Command in Bash?

The command function suppress the the shell function lookup in the search command order.

For command as a bash definition, see What is a Command in Bash?.

Syntax

command [-pVv] command [arg ...] 

where:

If either the V or v option is supplied, a description of command is printed.

Exit Status

Snippet

have_command () {
    command -v "$1" >/dev/null 2>/dev/null
}

require_command () {
  if ! have_command "$1"; then
    die 1 "Could not find required command '$1' in system PATH. Aborting."
  fi
}

Documentation / Reference