Bash shell奇怪的Tab补完问题

这两日用shell的时候在某些情况下(例如ls,但cd却正常)会出现Tab键补完目录或文件名之后多出一个空格。这问题在需要进入多层目录时很恼人。Ubuntu论坛里有解决方法,记下备忘。

注释掉/etc/bash_completion这个文件如下面那部分代码:

for i in a2ps awk bash bc bison cat colordiff cp csplit \
curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee \
texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o default $i
done
unset i

Advertisements
  1. 留下评论

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: