Giving the command ls
at the prompt would do a bit more than just call /bin/ls
. If ls
was an alias or a function, that alias or function would be called. If it was neither, and if it furthermore was not a built-in command (ls
is very rarely a built-in command), then a path search would be performed for ls
in each directory in the :
-delimited list in the $PATH
environment variable.
The ls
that was first found in $PATH
would be executed. This could potentially be another ls
than /bin/ls
if a directory that contained such a name was located earlier than /bin
in the $PATH
list.
使用/bin/sh
将绕过别名和函数查找以及其中的任何查找,$PATH
而是直接运行该命令。
在输出的色差之间ls
并/bin/ls
可能会因来解释ls
作为一个别名调用时增加了额外的命令行选项ls
实用程序(检查用alias ls
或type -a ls
在bash
)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句