When in bash, I can type the beginning of a command name (which is not necessarily in the current directory), hit tab a couple times, and a list of commands is displayed which start with what I have typed (almost looks like the list is being displayed with 'more', but I have to press Enter to scroll down the list).
My question is this, how does this functionality work? I want to be able to get a list of all commands that are auto-complete-able via hitting tab twice, so that I can pipe it to a file or grep.
BASH auto-complete of command namesHow to get a list of all commands
Page 1 of 1
3 Replies - 2128 Views - Last Post: 21 December 2007 - 09:31 PM
Replies To: BASH auto-complete of command names
#2
Re: BASH auto-complete of command names
Posted 18 December 2007 - 11:40 PM
Well, I was able to come up with a script to somewhat do this, I put the script in the snippets at http://www.dreaminco...snippet1537.htm
It doesn't do everything though, because if there are some built in bash commands, this script won't find them.
It doesn't do everything though, because if there are some built in bash commands, this script won't find them.
#3
Re: BASH auto-complete of command names
Posted 19 December 2007 - 04:49 AM
ericode, on 16 Dec, 2007 - 07:31 PM, said:
When in bash, I can type the beginning of a command name (which is not necessarily in the current directory), hit tab a couple times, and a list of commands is displayed which start with what I have typed (almost looks like the list is being displayed with 'more', but I have to press Enter to scroll down the list).
My question is this, how does this functionality work? I want to be able to get a list of all commands that are auto-complete-able via hitting tab twice, so that I can pipe it to a file or grep.
My question is this, how does this functionality work? I want to be able to get a list of all commands that are auto-complete-able via hitting tab twice, so that I can pipe it to a file or grep.
Why can't you just run a find with the start of the file name, against your path, or /usr/bin,/usr/sbin & pipe that with grep? Or an ls...?
#4
Re: BASH auto-complete of command names
Posted 21 December 2007 - 09:31 PM
no2pencil, on 19 Dec, 2007 - 04:49 AM, said:
ericode, on 16 Dec, 2007 - 07:31 PM, said:
When in bash, I can type the beginning of a command name (which is not necessarily in the current directory), hit tab a couple times, and a list of commands is displayed which start with what I have typed (almost looks like the list is being displayed with 'more', but I have to press Enter to scroll down the list).
My question is this, how does this functionality work? I want to be able to get a list of all commands that are auto-complete-able via hitting tab twice, so that I can pipe it to a file or grep.
My question is this, how does this functionality work? I want to be able to get a list of all commands that are auto-complete-able via hitting tab twice, so that I can pipe it to a file or grep.
Why can't you just run a find with the start of the file name, against your path, or /usr/bin,/usr/sbin & pipe that with grep? Or an ls...?
Right, that is what I want to do, but I want to do it for every directory in my $PATH. I read through the man page for find a couple times and couldn't find an option that would accept a list of directories.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|