【问题标题】:where command not found os x在哪里找不到命令 os x
【发布时间】:2012-05-03 02:04:00
【问题描述】:

好的,所以标题很容易解释,当我输入where ... 作为命令时,它会返回

-bash: where: command not found

我目前的 bash 个人资料包括:

export PATH="/usr/local/lib:$PATH"
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib/node_modules/bin:$PATH"

我用谷歌搜索了一段时间,发现大多数人只需要/usr/bin/usr/sbin,我两者都有。

有什么想法吗?

【问题讨论】:

    标签: macos unix terminal


    【解决方案1】:

    "where" 是 csh 的内置 shell。这就是你真正想要的吗?

    “which”和“whereis”在/usr/bin 下,告诉你在哪里可以找到给定的命令。

    【讨论】:

    • 是的,这就是我要找的东西,有趣的是我的 $PATH 中的 /usr/bin 找不到它
    【解决方案2】:

    正如 Stuart 所说,where 是一个 tcsh 内置命令。它是which 命令的扩展版本; which 告诉您命令名称解析为什么,where 显示可能找到命令的所有位置(包括别名、内置函数和 $PATH 中的可执行文件)的列表。

    bash 等效项是 type -a

    如果您愿意,可以将此函数定义添加到您的.bashrc.bash_profile

    where() { type -a "$@" ; }
    

    输出的格式并不完全相同,但它为您提供了相同的信息。

    (或者您可以考虑重新训练自己使用type -a 而不是where。)

    【讨论】:

      猜你喜欢
      • 2013-10-03
      • 1970-01-01
      • 2012-05-21
      • 2010-12-22
      • 1970-01-01
      • 2015-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多