意外的文件结尾./bash_profile

问题描述 投票:0回答:1

我对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"

关于我的问题可能是什么想法?

bash syntax
1个回答
2
投票

你的if应该有一个结束语,即fi

© www.soinside.com 2019 - 2024. All rights reserved.