commandest une fête builtin comme on peut le voir:
seth@host:~$ type command
command is a shell builtin
Donc, nous savons commandest fourni par notre shell, Bash. En creusant, man bashnous pouvons voir à quoi sert son utilisation:
(de 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.
Essentiellement, vous utiliseriez commandpour contourner la "recherche de fonction normale". Par exemple, supposons que vous ayez une fonction dans votre .bashrc:
function say_hello() {
echo 'Hello!'
}
Normalement, lorsque vous exécutez say_hellovotre terminal, bash trouve la fonction nommée say_hellodans votre .bashrc avant de trouver, par exemple, une application nommée say_hello. En utilisant:
command say_hello
fait de bash sa recherche de by - pass fonction normale et aller directement soit à builtins ou votre $PATH. Notez que cette recherche de fonction inclut également des alias. L'utilisation commandcontournera les deux fonctions et les alias.
Si l' -poption est fournie, bash contourne votre personnalisation $PATHet utilise ses propres valeurs par défaut.
Le -vou -Vdrapeaux bash affiche une description (abréviation de -vlong pour -V) de la commande.
Remarque: Comme Souravc a souligné dans les commentaires, une méthode plus simple pour trouver des informations sur les commandes intégrées au shell peut être trouvée ici: Comment utiliser `man` pour les commandes et les mots-clés intégrés au shell?