我在BASH下执行了以下命令来安装RVM:
brew install gnupg gnupg2
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -sSL https://get.rvm.io | bash
现在,当我打开终端时,收到以下错误消息:
-bash: eval: line 19: syntax error: unexpected end of file
这是我的.bash_profile:
export PATH=/usr/local/bin:$PATH
eval "$(rbenv init -)i"
alias sbl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
#changes prompt to be colorized and rearranges prompt to be "username@hotname:cwd $"
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
#enable command line colors, and define colors for the ‘ls’ command
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
#flags -G colorizes output, -h makes sizes human readable, and -F throws a / after a directory
alias ls='ls -GFh'
#Need to add below after 'brew install git bash-completion'
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
有人可以指出导致错误的原因吗?我不熟悉BASH编程。 RVM正在运行。
答案 0 :(得分:1)
在我看来,你在第二行的末尾有一个流浪的“我”:
eval "$(rbenv init -)i"
因此,eval
正在尝试运行如下所示的命令序列:
export PATH="/Users/pc3sq/.rbenv/shims:${PATH}"
# [...]
rbenv() {
# [...]
}i
...并且由于“} i”不是启动函数定义的“{”的有效匹配,eval
运行到“文件”的末尾(实际上只是一个字符串),而它是仍然在寻找一个“}”来关闭函数定义。