[Novalug] Missed "ksh" feature in bash

donjr djr1952@hotpop.com
Mon Mar 12 18:39:18 EDT 2007


On Mon, 2007-03-12 at 17:15 -0400, Peter Larsen wrote:
> This "completion" thing is new to me. Can you elaborate what it is - 
> other than somekind of alias configuration?
> 
> Regards
>    Peter Larsen
> 

The simplest usage is it lets you smarten up the TAB-complete key for
command options and other parameters.

Imagine typing at the prompt 'chgrp d<TAB>'{where <TAB> is the tab key}
and only getting a list of the GROUPS that start with the letter 'd'
instead of files that start with the letter 'd'.  {and that's one of the
more simpler examples of usage.}

For more infomation start with at a bash prompt there is:
$ help complete
complete: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat]
 [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
     For each NAME, specify how arguments are to be completed.
    If the -p option is supplied, or if no options are supplied, existing
    completion specifications are printed in a way that allows them to be
    reused as input.  The -r option removes a completion specification for
    each NAME, or, if no NAMEs are supplied, all completion specifications.

And 'info bash' has a whole section "8.7 Programmable Completion
builtins" on the complete command and it's sister command compgen.

Then you can read the comment in the file /etc/bash_completion

If you have the bash documentation installed then look at the files
in /usr/share/doc/bash-doc/examples/complete/ and
in /usr/share/doc/bash/completion-contrib/ a whole lot of examples of
usage.


--  
-- 
 Don E. Groves, Jr. 

$ /usr/games/fortune : 
The difference between the right word and the almost right word is the
difference between lightning and the lightning bug.  -- Mark Twain



More information about the Novalug mailing list