我尝试将这几行添加到我的.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
发布于 2016-09-15 02:37:27
尽管链接的存储库包含用于fish的脚本,但自述文件并未提供有关如何使用该脚本的任何说明。几年没用过fish了,我想你想要做的是添加
if status --is-login
source (brew --prefix)"/opt/bash-git-prompt/share/gitprompt.fish"
end改为~/.config/fish/config.fish。如果您不是在启动交互式shell,则if status命令可以防止不必要的文件来源。
发布于 2016-09-15 02:34:26
此错误消息:
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是由fish外壳生成的。
.bash_profile文件只能由bash外壳程序执行(源文件)。fish是一个不同的shell,具有不同的语法;它与bash不兼容。
如果使用fish作为交互式shell,并且希望在启动新shell时自动执行某些命令,则需要将特定于bash的命令转换为fish语法,并将它们添加到fish启动文件中。(使用fish的人不多,所以软件包提供商不太可能以fish语法提供启动命令--但这个包显然提供了;请参阅chepner's answer。)
https://stackoverflow.com/questions/39497196
复制相似问题