我确信我说错了这个问题。所以,让我解释一下我的问题,有人可以为我编辑。
我是Jekyll的新手,我安装了rbenv。我不确定我在哪里遵循指示。我的.bash_profile中有以下这行:
if which rbenv > /dev/null;
then eval "$(rbenv init -)";
fi
export PATH="$HOME/.rbenv/bin:$PATH"
我不知道它的作用或语言是什么。是shell还是bash还是什么?我是shell的新手。我是一名Windows用户。
当我用Google搜索时,我在其他网站上看到这就是我需要的所有内容:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
那么,有人可以逐行解释这段代码的作用吗?
答案 0 :(得分:1)
这是bash代码。因为它在.bash_profile
中,所以每次加载登录shell时都会执行它。
以下是用注释注释的代码,用于解释每行的作用:
if which rbenv > /dev/null; # Check if command rbenv is present
then eval "$(rbenv init -)"; # run the rbenv initialization scripts
# and evaluate the output
fi
export PATH="$HOME/.rbenv/bin:$PATH" # Update the PATH variable so the ruby commands
# are available
第二个代码段相当于第一个代码段,但它不会更新PATH
变量。