File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed
content/zh/docs/tasks/tools/included Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -62,29 +62,22 @@ Reload your shell and verify that bash-completion is correctly installed by typi
62
62
-->
63
63
### 启动 kubectl 自动补全功能 {#enable-kubectl-autocompletion}
64
64
65
+ #### Bash
66
+
65
67
<!--
66
68
You now need to ensure that the kubectl completion script gets sourced in all your shell sessions. There are two ways in which you can do this:
67
69
-->
68
70
你现在需要确保一点:kubectl 补全脚本已经导入(sourced)到 shell 会话中。
69
- 这里有两种验证方法:
70
-
71
- <!--
72
- - Source the completion script in your `~/.bashrc` file:
73
- -->
74
- - 在文件 ` ~/.bashrc ` 中导入(source)补全脚本:
75
-
76
- ``` bash
77
- echo ' source <(kubectl completion bash)' >> ~/.bashrc
78
- ```
79
-
80
- <!--
81
- - Add the completion script to the `/etc/bash_completion.d` directory:
82
- -->
83
- - 将补全脚本添加到目录 ` /etc/bash_completion.d ` 中:
84
-
85
- ``` bash
86
- kubectl completion bash > /etc/bash_completion.d/kubectl
87
- ```
71
+ 可以通过以下两种方法进行设置:
72
+
73
+ {{< tabs name="kubectl_bash_autocompletion" >}}
74
+ {{{< tab name="当前用户" codelang="bash" >}}
75
+ echo 'source <(kubectl completion bash)' >>~ /.bashrc
76
+ {{< /tab >}}
77
+ {{< tab name="系统全局" codelang="bash" >}}
78
+ kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
79
+ {{< /tab >}}}
80
+ {{< /tabs >}}
88
81
89
82
<!--
90
83
If you have an alias for kubectl, you can extend shell completion to work with that alias:
You can’t perform that action at this time.
0 commit comments