“命令”命令有什么作用?

“命令”命令有什么作用?

我最近偶然发现这command是一个命令,但是在它之后输入--help-h似乎只会产生类似这样的结果:

bash: command: --: invalid option
command: usage: command [-pVv] command [arg ...]

它没有manpage,它本身不是一个单独的包,我不知道它在哪个包中,也不知道它有什么用处... 我正在运行带有 GNOME 3.18 的 Ubuntu GNOME 15.10。那么,该命令有什么用处command?如何使用它?

答案1

来自'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 filename
          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 can‐
          not be found, the exit status is 127.  Otherwise, the exit  sta‐
          tus of the command builtin is the exit status of command.

相关内容