1. 程式人生 > >ubuntu下tab鍵不能自動補全命令的引數

ubuntu下tab鍵不能自動補全命令的引數


/etc/bash.bashrc 裡面有這幾行語句

#enable bash completion in interactive shells
# 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


去掉註釋
#enable bash completion in interactive shells
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

然後執行命令
. /etc/bash.bashrc

或者寫到~/.bashrc裡面並去掉註釋
然後執行命令
. ~/.bashrc

就ok了