我对bash语法完全不熟悉,完全不确定为什么我在shell中收到错误说:
-bash:/Users/apple/.bash_profile:第7行:语法错误:意外的文件结束
我的.bash_profile目前看起来像这样:
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
我注意到注释掉.bashrc部分会删除错误。这是我的简单.bashrc文件供参考:
export PS1="\[\e[31m\]\u\[\e[m\]: \w "
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
关于我的问题可能是什么想法?
你的if
应该有一个结束语,即fi
。