2

For some strange reason my filename autocomplete is behaving differently than normal. Given the following file structure ./foobar/file.txt, if I want to delete file.txt, I type rm foob<TAB><TAB> and let the command line autocomplete the filename out to rm foobar/file.txt.

But right now, after hitting the first <TAB> my command gets autocompleted to rm foobar (with a space after foobar). Is it possible that I accidentally changed it to this behavior? How can I change it back?

  • Is foobar a symlink or otherwise not a normal directory? – jw013 Oct 17 '12 at 19:14
  • @jw013 No, it is a regular directory, not a symlink – Cory Klein Oct 17 '12 at 19:17
3

In my experience, this is usually caused by some misbehaving configuration in one of the files in /etc/bash_completion.d, which get installed and updated as you install various packages. My recommendation would be to move all files out of that directory, start a fresh shell, and see if the behavior returns to normal. If so, you can move files back into that directory one (or a group) at a time to see which ones cause the problem. Once you narrow it down, report a bug in whichever package installed that file!

  • This worked. Guess what the culprit was - Adobe Reader. facepalm Think I'll have much luck reporting that bug? I at least have to try, I guess. – Cory Klein Oct 18 '12 at 14:44
0

Use complete -p rm to see the current completion of rm, see if the bash function really works as you wanted.

If you don't need the completion of rm, e.g parameters like -i, just put a line like this in your bash config,

complete -r rm; complete -o default rm (Remove current completion and set the default one)

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.