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

Re: Piping the output of bash completion; command line navigation



on Thu, Sep 04, 2003 at 12:43:04AM -0700, Josh Rehman (java.josh@verizon.net) wrote:
> Hi,
> 
> I was wondering if it is possible to grep through the output of bash 
> command line completion. If you type "k" and then tab twice, you'll be 
> asked to show all 398,499 entries on your path, y or n. Hit y and a big 
> list comes up. Seems like it would be nice to search through that list, 
> but there is no obvious way to pipe it to anything (like grep).

This should be equivalent:

    for d in $( echo $PATH | sed -e 's/:/ /g' ); do ls $p/k*; done | less

> Did some digging and found "complete" but it wasn't very helpful (it's
> a bash built-in and the man pages are terse). Am I messing up the
> command line? I tried stuff like complete -o default k but it just
> didn't take.  Google was little help.

'complete' is the action, not the command.  <tab> completes file
substitution to the next non-arbitrary point.  Repeat <tab> lists
alternatives, as you've found.

'complete-into-braces' (M-{) might give you what you want:

    [karsten@superego:karsten]$ k
    Display all 191 possibilities? (y or n)
    [karsten@superego:karsten]$ k               # hit <shift><alt>{
    k{eysign-fingerprint,mself@knight.gregfolkert.net,noppix}
    [karsten@superego:karsten]$ echo k{eysign-fingerprint,mself@knight.gregfolkert.net,noppix} 
    keysign-fingerprint kmself@knight.gregfolkert.net knoppix


> While I'm at it, is there a way to make "CTRL+Left Arrow" move one word 
> to the left on the command line? And similiarly for right? That would be 
> so great...IIRC DRDOS had that a long time ago. The win2k shell does 
> that, too.  I don't even know where to start looking for this one. :-)

    man bash
    /^ *Readline Key Bindings

Specifically:  forward-word and backward-word


Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
   Unless you are very rich and very eccentric, you will not enjoy the
   luxury of having a computer in your own home.
     -- Ed Yourdon, _Techniques of Program Structure and Design_, 1975

Attachment: pgpW6bKNEKOhO.pgp
Description: PGP signature


Reply to: