commandè un built-in bash come possiamo vedere:
seth@host:~$ type command
command is a shell builtin
Quindi sappiamo che commandè fornito dalla nostra shell, bash. Scavando man bashpossiamo vedere a cosa serve:
(da man bash):
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function
lookup. Only builtin commands or commands found in the PATH are
executed. If the -p option is given, the search for command is
performed using a default value for PATH that is guaranteed to
find all of the standard utilities. If either the -V or -v
option is supplied, a description of command is printed. The -v
option causes a single word indicating the command or file name
used to invoke command to be displayed; the -V option produces a
more verbose description. 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.
Fondamentalmente dovresti usare commandper bypassare la "ricerca di funzioni normali". Ad esempio, supponiamo che tu abbia una funzione nel tuo .bashrc:
function say_hello() {
echo 'Hello!'
}
Normalmente, quando si esegue say_helloin bash terminale avrebbe trovato la funzione denominata say_hellonella vostra .bashrc prima ha trovato, per esempio, un'applicazione denominata say_hello. usando:
command say_hello
fa in modo che bash bypass la sua normale funzione di ricerca e vada direttamente al tuo builtin o al tuo $PATH. Questa ricerca di funzioni include anche alias. L'uso commandignora sia le funzioni che gli alias.
Se l' -popzione viene fornita, bash ignora la tua abitudine $PATHe utilizza il suo valore predefinito.
Il flag -vo -Vbash stampa una descrizione (abbreviazione di -v, long for -V) del comando.
Nota: Come sottolineato da souravc nei commenti, un metodo più semplice per trovare informazioni sui builtin della shell può essere trovato qui: Come far funzionare `man` per i comandi e le parole chiave incorporati della shell?