Bash - Command (The Builtin command command)

Bash Liste Des Attaques Ovh

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:

  • command is the command to execute. Only builtin commands or commands found in the PATH are executed.
  • args are arguments
  • p will guarantee to find all of the standard utilities by using a default value for PATH.
  • v causes a single word indicating the command or file name used to invoke command to be displayed;
  • V produces a more verbose description.

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

Exit Status

  • If the -V or -v option is supplied, the exit status is 0 if command was found, and 1 if not.
  • If neither option is supplied and an error occurred or command cannot be found, the exit status is 127. Otherwise, the exit status of the command builtin is the exit status of command.

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





Discover More
Bash Liste Des Attaques Ovh
What is a Command in Bash?

This page is command in bash. Command are in bash the expression unit A command (or an expression) is a sequence of words separated by blanks, terminated by a control operator. Each command execution...



Share this page:
Follow us:
Task Runner