Tab completion in Bash

davidbrit2

Licensed Computer Geek
How do I configure it? I want it to behave as in tsch, i.e. no obnoxious beeping on ambiguity, and automatically listing all possible matches without hitting tab twice. I can't find any good documentation on setting this up.
 
In your .bashrc file include the following two lines:

set autolist
set filesc

Now I must say that it doesn't get rid of the beeping, and you do have to hit tab twice, but after working in the bash shell for a while, you get used to it.
 
That's just the thing, I don't want to get used to it. The beeping is extremely irritating, and pressing tab twice is almost equally so. Am I to understand that there's no way to configure this in bash? Guess I'd better go download the source... Heh.
 
I don't know any other way personally, as I've just really started to use bash as of 10.3. I don't get into the 'holy wars' of what shell is better, as I don't do any shell scripting, and first the c and c++ programs I write either shell has worked fine for me.

I do recall though, that in the tcsh shell that it would auto-list with one tab, but would still beep in the process.

good luck with the source code.... ;)
 
Yeah, I'm not too big on the holy wars nonsense either. I just want a shell with convenient interactive features, and I'll do all the programming with perl. ;-) I'll just stick with tcsh for now. Frankly I think it's got bash beaten in terms of an interactive shell. And it might be a little bit faster, too, though I could be imagining things.
 
what does this do that is unique? i noticed no difference from the default setup. are you referring to bash-completion, like the program available on fink or what not?
 
I'm not quite sure what you mean.

Basically, I want the command line tab completion to work more like in tcsh with the autolist variable set.
 
there is a bash-completion script/program/addon for bash that allow bash to act like zsh(i think). i've only used it for linux, but i'm probably going to try it out for os x now. i think you can get it through fink.

an example, say you ssh localhost, you do

> ssh l<tab>

and it will finish it out for you.

likewise

>java t<tab>
will complete to "test.class" and

>javac t<tab>
will complete to "test.java"

it was nice when i used it back in the day. but bash works for me like tcsh did with autolist set by default. go figure.
 
solved the "multiple tabbing" problem you were having...

set show-all-if-ambiguous on

If you have this in your /etc/inputrc or ~/.inputrc, you will no longer have to hit the <Tab> key twice to produce a list of all possible completions. A single <Tab> will suffice. This setting is highly recommended.

that is from http://www.caliban.org/bash/index.shtml

check it out
 
Hmm, interesting stuff. I can't get Bash to respond to the show-all-if-ambiguous shell variable, though.
 
I just did it with set from the command line. It does seem to work though when placed in inputrc, though I'm not sure where it's being set. The list of shell variables doesn't show it. Weird.
 
Ah just what I was looking for. I had almost switched back to tcsh too but thought I should learn bash because it's standard on most linux distros. Don't worry davidbrit2, you aren't alone in thinking that this behavior of bash is a step backwards from tcsh.
 
Back
Top