Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
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. –  njsg Jan 24 '13 at 13:32
    
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. –  vonbrand Jan 26 '13 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 :| –  Justin L. Feb 14 '13 at 21:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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