缺少平衡此 if 语句的结尾
missing end to balance this if statement
我尝试将此行添加到我的 .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
此错误信息:
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
生成shell.
.bash_profile
文件仅供 bash
shell 执行(来源)。 fish
是一个不同的 shell,具有不同的语法;它与 bash
.
不兼容
如果您使用 fish
作为互动 shell,并且您希望在启动新的 shell 时自动执行某些命令,则需要翻译bash-特定命令到 fish
语法,并将它们添加到您的 fish
启动文件中。 (使用 fish
的人并不多,因此软件包提供商不太可能以 fish
语法提供启动命令——但这个软件包显然可以;请参阅 。)
尽管链接的存储库包含 fish
的脚本,但 README 并未提供有关如何 使用 该脚本的任何说明。好几年没用过 fish
,我 认为 你想做的是添加
if status --is-login
source (brew --prefix)"/opt/bash-git-prompt/share/gitprompt.fish"
end
改为~/.config/fish/config.fish
。如果您没有启动交互式 shell.
,if status
命令可防止文件被不必要地获取
我尝试将此行添加到我的 .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
此错误信息:
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
生成shell.
.bash_profile
文件仅供 bash
shell 执行(来源)。 fish
是一个不同的 shell,具有不同的语法;它与 bash
.
如果您使用 fish
作为互动 shell,并且您希望在启动新的 shell 时自动执行某些命令,则需要翻译bash-特定命令到 fish
语法,并将它们添加到您的 fish
启动文件中。 (使用 fish
的人并不多,因此软件包提供商不太可能以 fish
语法提供启动命令——但这个软件包显然可以;请参阅
尽管链接的存储库包含 fish
的脚本,但 README 并未提供有关如何 使用 该脚本的任何说明。好几年没用过 fish
,我 认为 你想做的是添加
if status --is-login
source (brew --prefix)"/opt/bash-git-prompt/share/gitprompt.fish"
end
改为~/.config/fish/config.fish
。如果您没有启动交互式 shell.
if status
命令可防止文件被不必要地获取