【发布时间】:2016-09-14 18:23:44
【问题描述】:
我尝试将此行添加到我的 .bash-profile
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ];then
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
但我收到此错误
Missing end to balance this if statement
.bash_profile (line 2): if [ -f "$(brew --prefix)/opt/bash-git- prompt/share/gitprompt.sh" ]; then
^
from sourcing file .bash_profile
called on standard input
有人知道为什么吗? 我有来自这里的代码 https://github.com/magicmonty/bash-git-prompt
【问题讨论】:
-
为什么这个问题被标记为“鱼”?您是否尝试从鱼壳中获取您的
.bash_profile? Fish 是具有不同语法的不同 shell;它与 bash 不兼容。 -
感谢您的回答,我已删除标签
-
不过,
.bash_profile (line 2):看起来像fish用于错误消息的格式。你确定你不是从fish采购你的.bash_profile吗? -
不要移除标签;这是完全相关的,因为您发布的错误消息来自
fish,而不是bash。 -
@Arthur 问题是,你运行的是
fish,而不是bash。gitprompt.sh脚本与fish无关。在任何情况下,您都不应尝试在fish会话中获取.bash_profile。