相当于“哪个"是什么意思?对于不引用可执行文件的命令? [英] What is the equivalent to "which" for commands that don't refer to executables?

查看:39
本文介绍了相当于“哪个"是什么意思?对于不引用可执行文件的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出特定命令的定义方式.我检查了 $ PATH 的所有位置,找不到类似于我的命令那样命名的文件,因此似乎还有其他内容.

I'm trying to find out how a specific command is defined. I've checked all locations of $PATH and could not find any file that is named like my command, so it seems to be something else.

以下是使用nvm的示例,它不是可执行文件:

Here is an example using nvm, that is not an executable:

me@MacBook:~$ which cat
/bin/cat
me@MacBook:~$ which nvm
me@MacBook:~$ nvm --version
0.33.8

其中nvm 根本不返回任何内容.

which nvm simply returns nothing.

在基于Unix的系统中,像这样的命令的哪个"等价于什么?

What is the equivalent of "which" for commands like this in unix based systems?

推荐答案

您要查找的命令是 type .

类型nvm 将显示外壳如何解释命令,因此与哪个不同,它还将显示别名,函数和未导出的路径.

type nvm will show how the shell will interpret the command, so unlike which it'll show aliases, functions and unexported paths too.

这篇关于相当于“哪个"是什么意思?对于不引用可执行文件的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆