2012/06/07

开启命令行任意命令的自动补全 - Set the command to auto-complete in command line


0.说明
比如我需要在某个命令后面接上一长串其他命令,但是第一个命令不支持后续内容的自动补全,整个命令写起来就会非常麻烦。

1.方法
以proxychains为例,在.bashrc里面加入:
complete -o filenames -F _root_command proxychains
这样用proxychains开头的命令,后面附加的其他内容也可以自动补全了。

<English Version>
0.Background
When you want to use a command, and after this command you will have to type many other words, what if the command doesn't support auto-completion?

1.Method
Take proxychains as an example, just add this into your .bashrc file in your home folder:
complete -o filenames -F _root_command proxychains
Then source it:
$source .bashrc
When you write commands begin with 'proxychains', the words after it will auto-complete now.