1、利用vi编辑器打开/etc/bash.bashrc文件(需要root权限)
Shell代码
sudo vi /etc/bash.bashrc
接下来会提示输入密码
2、找到文件中的下列代码
Shell代码
1. #enable bash completion in interactive shells
2. #if ! shopt -oq posix; then
3. # if [-f /usr/share/bash-completion/bash_completion ]; then
4. # . /usr/share/bash-completion/bash_completion
5. # elif [ -f /etc/bash_completion]; then
6. # . /etc/bash_completion
7. # fi
8. #fi
将注释符号#去掉,即改成
Shell代码
1. #enable bash completion in interactive shells
2. if ! shopt -oq posix; then
3. if [-f /usr/share/bash-completion/bash_completion ]; then
4. . /usr/share/bash-completion/bash_completion
5. elif [ -f /etc/bash_completion]; then
6. . /etc/bash_completion
7. fi
8. fi
3、最后 source一下 /etc/bash.bashrc即可, 即
shell代码,如果说sudo下没有source命令,就把sudo去掉就行了。
1. sudo source /etc/bash.bashrc
网友评论