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

Re: Bash autocompletion



On Thursday 17 April 2003 17:22, Kevin McKinley wrote:
> On Thu, 17 Apr 2003 10:59:44 +0200
>
> Michael Naumann <michael.n@strux.net> wrote:
> > I find the TAB-completion feature of bash very handy and use
> > it everytime. Yet I have two issues with this feature.
> >
> > a) I start a commandline like
> > scp gemini:/tm
> > here I press tab (gemini is a valid hostname in my network).
> > The line becomes:
> > scp gemini:gemini\:/tmp
> > and is thus pretty useless.
> > What can I do to prevent this?
>
> Nothing. You're asking the system to do the impossible, and bash is good
> but not telepathic.

One might think so and in fact some on this list were on your line.
But this underestimating the power and flexibility of bash.
As Lucien Saviot pointed out, it was simply a bug in /etc/bash_completion that
comes with woody.
Installing a newer version from http://www.caliban.org/bash/index.shtml
solved the problem.

> When you type the scp command you're not on the remote
> system yet, so there's no way bash to know what the remote root filesystem
> looks like.

Well, I did not look to close into /etc/bash_completion, but as I understand it
there can be arbitrary code executed. In the case of scp, this code simply
asks the other side for matches.

>
> > b) If a file does not have the proposed extension the completion
> > will not work. Example:
> > I have a file called "Song of joy.mp2"
> > Now I start the commandline
> > xmms Song
> > Here I press tab, but due to the .mp2 (instead of .mp3) part
> > of the filename nothing gets expanded.
> > Can this clever autoindent feature be disabled temporarily?
>
> You've told xmms where your music is stashed, but bash has no way to know
> that. If you did "xmms /path/to/mp2s/Song<tab>" the path completion should
> work.

No, it does not, since the completion code for xmms does not expect the
extension .mp2 and thus ignores/skips these files.

>
> It may be possible to tweak /etc/bash_completion to make this work, but I'm
> not familiar with it.
>
> Kevin

- Michael



Reply to: