在终端中输入“which rbenv”命令给出奇怪的输出

问题描述 投票:0回答:0

基本上是标题。我在 M1 Macbook Pro 上。

结果我得到了这个输出:

rbenv () {
    local command
    command="${1:-}"
    if [ "$#" -gt 0 ]
    then
        shift
    fi
    case "$command" in
        (rehash | shell) eval "$(rbenv "sh-$command" "$@")" ;;
        (*) command rbenv "$command" "$@" ;;
    esac
}

为什么这是我的输出,为什么它不告诉我 rbenv 的路径?这一切到底意味着什么?

我使用 zsh,所以我尝试使用我的 .zshrc 文件来确保我没有遗漏任何东西。这是它的样子(省略无关部分):

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
ZSH_THEME="simple"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

...

export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"

eval "$(rbenv init -)"

在 Gordon Davisson 的评论之后,我能够更有意地在 Google 中表达我的问题,并发现这个 GitHub 线程链接对我很有帮助:https://github.com/rbenv/rbenv/issues/418

据我了解,我好像在使用 zsh 的同名内置命令。输入

command which rbenv
为我提供了我正在寻找的输出,这是 rbenv 可执行文件的路径。

ruby macos rbenv oh-my-zsh zshrc
© www.soinside.com 2019 - 2024. All rights reserved.