安装的RVM,rvm命令不起作用

Gen*_*nik 4 ruby rubygems ruby-on-rails rvm

我刚刚完成了RVM安装.

我做了这个命令:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Run Code Online (Sandbox Code Playgroud)

一切都很好.然后在我的用户主目录中,在.bash_profile中我添加了

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Run Code Online (Sandbox Code Playgroud)

然后我开始一个新的shell只是为了确定.然后我试了一下

rvm 
Run Code Online (Sandbox Code Playgroud)

并得到了错误

No command 'rvm' found
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会发生?

Jim*_*ris 8

也许是因为.bash_profile只在登录时运行,如果你运行一个新的shell它只执行.bashrc

你可以测试使用

> bash -l
Run Code Online (Sandbox Code Playgroud)


Ant*_*ton 5

您是否在页面上看到"安装疑难解答"部分.

它提到您需要return从.bashrc中删除.我经常忘记在新的ubuntu安装上执行此操作.

他们为ubuntu提供的例子是改变这个:

[ -z "$PS1" ] && return
# Some code here... e.g.
export HISTCONTROL=ignoreboth
Run Code Online (Sandbox Code Playgroud)

对此:

if [[ -n "$PS1" ]]; then
  # Some code here... e.g.
  export HISTCONTROL=ignoreboth
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session
Run Code Online (Sandbox Code Playgroud)