15

Previously, if I typed ~/biTab, before, it would turn into ~/bin. However, today it started turning ~/biTab into /home/username/bin.

I would rather have it the former, but I'm not sure what happened ... I did add a script to edit my bash completion but I removed it from my ~./bashrc and restarted the server.

Does anyone know what would cause this to happen? Or how I would change it back?

EDIT So I found out what might cause this...it has to do with /etc/bash_completion and things like that. When I do bind -v, it shows tilde expansion to be off.

So I think if I edit this (kind of like a hack), it will go away. But that doesn't really satisfy anything -- how did this change even happen in the first place? I never ran anything as sudo, and after multiple shutdowns and restarts this behavior persists.

George M
14.2k4 gold badges45 silver badges53 bronze badges
asked Jan 24, 2013 at 12:46

1 Answer 1

10

You don't mention what distribution you are using (please include that information in your question), but I've seen similar behavior after running updates on my systems.

My best guess is when you ran a system update, or if it ran automatically, the "bash-completion" package was updated which added this behavior. In Red Hat derivatives, you can find package documentation in /usr/share/doc/PACKAGENAME. In my /usr/share/doc/bash-completion-1.3/CHANGES, new changes are listed via a change log format.

Instead of modifying /etc/bash_completion, which could potentially get overwritten at the next package upgrade, you can create ~/.inputrc to disable tilde expansion. I confirmed bash_completion-1.3.6 will honor this on my Fedora 16 box.

set expand-tilde off

EDIT

Your mileage may vary with ~/.inputrc. Bash has functions that may override that behavior depending on what you try to complete (e.g. a program vs a file or directory). This discussion on Super User SE addresses a similar question when autocompleting a vim command. In this case, the original poster solved his issue by adding a custom function to his ~/.bashrc.

answered Jan 24, 2013 at 13:22
3
  • 1
    The last bit also depends on the distro. Some distros (for example, Gentoo) actually do the right thing and don't overwrite files under /etc if they have been changed. Commented Jan 24, 2013 at 13:32
  • 1
    Red Hat derivatives do so too. The replacement configuration file xxx file is then called xxx.rpmnew if the configuration changes aren't critical; if the changes in configuration are really required, then the original is renamed xxx.rpmsave and xxx is the file from the package. Commented Jan 26, 2013 at 6:39
  • expand-tilde doesn't work, I ended up just deleting the code that did the expansion from my computer. It will probably break on system upgrades but :| Commented Feb 14, 2013 at 21:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.