可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I just installed RVM on a Debian 6 server, without having any problem in the beginning. However after everything is set up, I can't run RVM in the terminal. The message I get when I type rvm use
is:
RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example.
rvm installation not working: "RVM is not a function"" they managed to solve the problem but not for SSH.
回答1:
run:
rvm get stable --auto-dotfiles
it will remove and re-add rvm lines from shell initialization files
for ssh
connections to work you need to set your shell as bash
(preferred) or zsh
, you can check your current shell with:
getent passwd $USER | awk -F: '{print $NF}'
and if it is not bash
/zsh
change it with:
chsh $USER --shell `which bash`
回答2:
You need to source /etc/profile.d/rvm.sh
first. Add the following line to your .bashrc
(or type it at the prompt) :
source /etc/profile.d/rvm.sh
Alternatively, if you need a function, the following script works for me :
#!/bin/sh #RVM stuff # Load RVM into a shell session *as a function* if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then # First try to load from a user install source "$HOME/.rvm/scripts/rvm" elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then # Then try to load from a root install source "/usr/local/rvm/scripts/rvm" else printf "ERROR: An RVM installation was not found.\n" fi
回答3:
When SSH launches bash, bash doesn't source .bashrc, in default builds (there is a compile-time flag, SSH_SOURCE_BASHRC
, that forces it to). Try using something like this in your SSH command line:
ssh user@host "bash -i"
See ssh command execution doesn't consider .bashrc | .bash_login | .ssh/rc?.