美文网首页Kubernetes
kubectl命令补全

kubectl命令补全

作者: rushui | 来源:发表于2021-06-08 17:33 被阅读0次

安装bash-completion

brew install bash-completion

复制kubectl completion bash到completion目录

kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl

查看要添加到.bash_prfile的语句:

brew info bash-completion
Add the following line to your ~/.bash_profile:
  [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

将以下内容添加到~/.bash_profile

vim ~/.bash_profile
追加
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"

生效

source ~/.bash_profile

相关文章

网友评论

    本文标题:kubectl命令补全

    本文链接:https://www.haomeiwen.com/subject/ajsjeltx.html