Bash 如何为gcloud启用shell命令完成?

Bash 如何为gcloud启用shell命令完成?,bash,shell,google-cloud-platform,Bash,Shell,Google Cloud Platform,我正在尝试使用install.sh脚本在Mac上安装Google Cloud SDK(如下所示): ~/Downloads$ ./google-cloud-sdk/install.sh 在记录的输出中,我看到以下说明: ==> Source [/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gclou

我正在尝试使用
install.sh
脚本在Mac上安装Google Cloud SDK(如下所示):

~/Downloads$ ./google-cloud-sdk/install.sh
在记录的输出中,我看到以下说明:

==> Source [/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.
实际上,我发现使用
gsutil
命令仍然会导致
-bash:gsutil:command not found
错误,因此我可能仍然必须执行此步骤

然而,我并不完全清楚这些指示的含义。我在Mac电脑上,我的bash档案是
~/.bash\u档案
。为了使命令行完成工作,我必须添加哪些行

更新

第一次安装时,我没有使用
sudo
。使用
sudo
重新安装时,我会收到一个额外的提示,提示是否修改我的bash配置文件,在接受后,将导致以下行添加到我的
。bash\u配置文件中

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc' ]; then source '/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc'; fi

但是,我仍然得到
gsutil:command not found
错误。

诀窍是使用
sudo
运行
install.sh
,如更新中所述。之后,我需要重新启动终端(如说明中所述),以使更改生效。

对于Mac,请在下面运行命令以运行
install.sh


sudo chmod+x install.sh

你能告诉我们
哪个gsutil
的输出吗?
哪个gsutil
没有输出…对于Ubuntu(20.04 LTS),我找到了一个解决我的问题的方法!