【发布时间】:2017-02-13 13:19:38
【问题描述】:
在 Linux 机器上,我正在尝试按照https://cloud.google.com/storage/docs/gsutil_install 上的说明安装 gsutil。在安装过程中,我对所有内容都回答“是”并将其保留为默认值。
但是,现在,如果我打开一个新终端,它会以 bash 错误开始:
bash: /home/kurt/.bashrc: line 119: syntax error near unexpected token `fi'
bash: /home/kurt/.bashrc: line 119: `fi'
kurt@kurt-ThinkPad:~$
违规行包含在我的.bashrc 文件的以下 sn-p 中:
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
source '/home/kurt/Downloads/google-cloud-sdk/path.bash.inc'
fi
source '/home/kurt/Downloads/google-cloud-sdk/completion.bash.inc'
fi
错误发生在倒数第二个fi 语句中。实际上,看起来最后两个 fis 与任何 if 都不匹配。我可以注释掉最后三行,但我不确定这是否会破坏功能。有什么建议吗?
【问题讨论】:
-
为什么最后3行毫无逻辑地挂了?
-
这也让我感到困惑。 Google 似乎不太可能发布带有语法错误的代码,但这些行似乎是由安装程序添加的。