help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] How to output TAB completion result to pipe?


From: Eric Blake
Subject: Re: [Help-bash] How to output TAB completion result to pipe?
Date: Wed, 01 Aug 2012 15:03:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 08/01/2012 02:49 PM, Peng Yu wrote:
> Hi,
> 
> TAB completion may results in many candidates, in which case I want to
> pipe it to less or a file. Is there a way to do?

compgen ... | pipe_command
compgen ... > file

Basically, 'compgen' is the workhorse that lets you generate completion
candidates and convert it into a list of lines that you can then further
process, used heavily within custom completion libraries.  I'll leave it
to you to read 'help compgen' to see which options you need to pass.  If
you have a custom completion library installed, such as the
'bash-completion' package, you may find that 'set -vx' prior to hitting
TAB will give you some insight into how compgen is called.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]