Re: Piping the output of bash completion; command line navigation
Karsten M. Self wrote:
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
I think this should be:
for d in $( echo $PATH | sed -e 's/:/ /g' ); do ls $d/k*; done | less
But yes, this works pretty well, thanks! (It chokes on bad directories in the path, and prints out full file names, and doesn't include bash built-ins, but otherwise works perfectly :-)
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
Thanks for that. I'm sure I'll be playing with this quite a lot for a bit.
FWIW this helped me to discover that Bash already supports word
navigation and deletion: Alt+f, Alt+b, Alt+d does forward, back, and
delete respectively. Seems to me that CTRL+Left Arrow etc should be part
of the default bindings. But what do I know?
Thanks again!
Reply to: