“which -a” 命令如何工作?

“which -a” 命令如何工作?

-a中的标志非常which有用。但是,我不确定它如何查找替代命令。有人能解释一下吗?它是否对命令名称进行部分字符串匹配?还是其他什么?

答案1

阅读手册页。在终端中写入man which...

DESCRIPTION

   which returns the pathnames of the files (or links) which would be exe‐
   cuted in the current environment, had its arguments been given as  com‐
   mands  in a strictly POSIX-conformant shell.  It does this by searching
   the PATH for executable files matching the names of the  arguments.  It
   does not canonicalize path names.

相关内容