1

I started with this problem:

Bash disables autocompletion for some commands

The only difference was that in my case the command in question was configure. I successfully applied the solution described in that question (i.e. you should remove the completion with complete -r configure). The problem is... if you try the completion once, it comes back from the dead.

$ complete -p configure 
complete -F _configure configure       # Hum... there *is* a completion

$ complete -r configure                # So let's remove it!

$ complete -p configure 
bash: complete: configure: no completion specification   # Ha! It's gone!

                                       # Let's try it now.
$ ./configure <TAB>                    # Damn! It still doesn't work!

$ complete -p configure                # It's back from the dead!!!
complete -F _configure configure

Does anybody know how to solve this?

EDIT:
One more piece of information:

I added complete -p configure to my .bashrc and then it started giving me this error on startup:

bash: complete: configure: no completion specification

This is interesting. The completion for configure doesn't exist at startup... It seems that some kind of dynamic completion definition is happening here.

  • Is your goal to permanently disable tab autocomplete for all commands, or just specifically configure? – kemotep Dec 13 '18 at 15:08
  • Just for configure. – tfga Dec 13 '18 at 17:15
  • Configure is a special Linux script, not a command. Your understanding of complete is incorrect. complete -p configure needs an additional parameter, i.e the word to auto complete as shown in your complete -F _configure configure example. To disable tab autocomplete for configure you either need to disable auto completion entirely, which you do not want, or disable autocomplete for filenames. Since complete references commands and configure is not a command but a script it does not work the way you want it to. Is this related? – kemotep Jan 2 at 20:00
2

Yes, the script for configure gets loaded dynamically.

You can confirm that with setting the option that prints all executed commands with set -x. And try to autocomplete with TAB.

The clue to find the source is the output of this command

dpkg -L bash-completion | xargs egrep '\<_configure\>' 2>/dev/null

Just delete the file for configure and restart your bash instance or clear with complete -r configure.

sudo rm /usr/share/bash-completion/completions/configure
  • Thanks! :) Just out or curiosity: do you know what this completion actually does (or is supposed to do)? For me, it never did anything besides disabling file completion. – tfga 2 days ago
  • It tries to run configure with the --help parameter, parse its output for possible options to give in the completion. – Denis Nikolaenko 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.