bash 内置type
可以很好地确定给定命令将做什么以及它是如何定义的,但是如果命令最终解析为文件,则不能直接提取文件路径。例如,要仅执行$PATH
查找,您可以使用which
:
$ ls true
ls: cannot access true: No such file or directory
$ ls `which true`
/bin/true
假设我有一个别名:
alias notfalse=true
然后我不能只问which
,但我可以问type
:
$ type notfalse
notfalse is aliased to `true'
但我想要的是让它通过调查来解决别名$PATH
(不,各种标志type
似乎不起作用)。
$ ls `somebuiltin notfalse`
/bin/true
忽略有一个true
内置函数(我用别名隐藏),这只是一个例子。