LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-17-2006, 06:24 AM   #1
tphyahoo
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Rep: Reputation: 0
grep through tab completion list results


When I do $ myname_ << tab tab

I get lots of possibilities. Because I have customized my shell a lot, with the convention that my personal functions usually start with "my name". (It's all under version control, and the first thing I do when I have to start working on a new computer -- and there's a lot of them -- is I check out my "shell environment" so I feel at home.)

I'm wondering if there's a way I can "grep" through the tab completion list, to narrow down the list of possibilities if there is some function/alias I can remember having written, but I can't remember exactly how I named it.

Thanks!
 
Old 11-18-2006, 07:34 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Not sure about filtering the tab completion list (I'd love to know if there is a way), but you can check for specific environment variables by doing
Code:
set |grep ...
 
Old 11-18-2006, 08:40 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
This may not be exactly what you want, but I found this code snippet for your bashrc file on some "tips & tricks" thread a while back that's supposed to show you all the previous entries for a command in your history. However for some reason it never worked for me. Maybe it'll do something for you.

Code:
# user added binds to special keys:
# <Alt>+w to show all possible completions for a command from history.
bind '"\M-w"':"\"\C-k\C-ahistory | grep '^ *[0-9]* *\C-e.'\C-m\""
In the meantime, at least there's always <crtl>-r and <crtl>-s for searching backwards and forwards through your history.

If you know something about scripting, there should be an /etc/bash_completion file that has all sorts of code controlling what gets completed and what doesn't. Don't ask me how it all works though.
 
  


Reply

Tags
grep, readline


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab completion with sudo extrasolar Slackware 8 08-22-2006 02:46 PM
adding an option to a 'tab' completion + ls whatnoname Linux - Newbie 2 06-07-2005 07:32 AM
tab completion with scp fsbooks Linux - General 5 04-07-2005 03:13 PM
How can I turn on/install tab completion which I am so used to. jimdaworm *BSD 2 04-06-2005 11:25 PM
apt-get tab completion atheist Debian 6 06-11-2004 08:25 PM


All times are GMT -5. The time now is 07:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration