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

Re: Tab Tab program/command line editing

On Mon, Jul 05, 1999 at 10:14:35PM -0500, ktb wrote:
> If you hit the tab key twice in a row it lists all available commands. 
> This seems like a useless thing because I see no way of sending the
> output to 'less' and most of the 1917 possibilities scroll off the
> screen.  Anyway my problem is I get the same result if I hit the Esc key
> twice.  I'm learning command line editing and when I use Esc-b for
> example and then Esc-f I get the following,
> Display all 1971 possibilities? (y or n)
> I searched with 'apropos' and did a search in the bash man page and
> can't find the program that lists the commands or where this emanates
> from.  I'd like to get rid of it unless someone else has a better idea. 
> Anyone know the name of this program?

The behavior you see is from the shell program.  Pressing <tab> tells
the shell to attempt to complete a partial word.  If it can not tell
without ambiguity what word to complete, the shell will beep.  If you
then press <tab> a second time, it will list the possible completions.
If there are a large number of possible completions, the shell will ask
you before displaying them.  The word that the shell tries to complete
depends upon the cursor's current position within a command line.  When
the cursor is over the first word, the shell is trying to match against
a command name.  With the cursor on a subsequent word, the shell tries
to match against a filename.  Bash supports this feature.  Other shells
might, but I am not sure of that.  Interestingly enough, since the code
library which contains this functionality is GPL'd, other programs, such
as ftp clients, also support filename completion.

As for your particular use, the first time you press <tab>, your shell
attempts to match to a command.  Since you have not yet started to type
a command name, the complete list of commands is a potential match.
When you press <tab> a second time, your are offered a chance to see the
list of possible matches.

Try typing a partial command name, followed by a <tab> or two and you
will see more completely what I mean.  Try typing <tab> while in the
middle of a program's argument, for filename completion.

Good Luck,

David H. Silber  --   http://www.orbits.com/~dhs/   --   dhs@orbits.com

  For custom software, see:                http://www.SilberSoft.com/
  Palm OS / Linux Documentation:          http://www.orbits.com/Palm/  

Reply to: