Sunday, February 11, 2007

Programmable Completion with BASH

Most people know that when using the BASH interpreter you can hit tab and the file will complete or output the matches for you to refine the search. But not all know you can do with with many binaries too. When I say this I mean actual parameters.

colabus@typhon:~# dpkg --cont<tab>
--contents --control
colabus@typhon:~# dpkg --contents /var/cache/apt/archives/ruby1.8_1.8.5-4_i386.deb

To do this run or add the following line to your .bashrc file.

. /etc/bash_completion

Simply sourcing the bash_completion file to use in the shell.

It's handy! :)

No comments: