The command built-in executes or identifies a command.
Syntax
-
command [-befp] command [argument…]
-
command -v|-V [-abefkp] command…
Description
Without the -v
(--identify
) or -V
(--verbose-identify
) option, the
built-in executes command with arguments in the same manner as the
last step of execution of simple commands.
The command is treated as a built-in or external command or a function
according to the options specified to the command built-in.
The shell does not exit on argument syntax error etc. even if the command is a
special built-in
With the -v
(--identify
) option, command is identified.
If the command is found in $PATH
, its full
pathname is printed.
If it is a keyword, function, or built-in that is not found in $PATH
,
the command name is simply printed.
If it is an alias, it is printed in the form like
alias ll='ls -l'
.
If the command is not found, nothing is printed and the exit status is
non-zero.
The -V
(--verbose-identify
) option is similar to the -v
(--identify
)
option, but the output format is more human-friendly.
Options
-
-a
-
--alias
-
Search for the command as an alias. Must be used with the
-v
(--identify
) or-V
(--verbose-identify
) option. -
-b
-
--builtin-command
-
Search for the command as a built-in.
-
-e
-
--external-command
-
Search for the command as an external command.
-
-f
-
--function
-
Search for the command as a function.
-
-k
-
--keyword
-
Search for the command as a keyword. Must be used with the
-v
(--identify
) or-V
(--verbose-identify
) option. -
-p
-
--standard-path
-
Search the system’s default
PATH
instead of the current$PATH
. -
-v
-
--identify
-
Identify commands and print in the format defined in the POSIX standard.
-
-V
-
--verbose-identify
-
Identify commands and print in a human-friendly format.
If none of the -a
(--alias
), -b
(--builtin-command
), -e
(--external-command
), -f
(--function
), and -k
(--keyword
) options
is specified, the following defaults are assumed:
-
Without the
-v
(--identify
) or-V
(--verbose-identify
) option -
-b -e
-
With the
-v
(--identify
) or-V
(--verbose-identify
) option -
-a -b -e -f -k
Operands
- command
-
A command to be executed or identified.
- argument…
-
Arguments passed to the executed command.
Exit status
The exit status of the command built-in is:
-
Without the
-v
(--identify
) or-V
(--verbose-identify
) option -
the exit status of the executed command.
-
With the
-v
(--identify
) or-V
(--verbose-identify
) option -
zero unless there is any error.
Notes
The command built-in is a mandatory built-in.
In the POSIXly-correct mode, options other than -p
, -v
,
and -V
cannot be used and at most one command can be specified.
The POSIX standard does not allow specifying both -v
and -V
together, but
yash does (only the last specified one is effective).