Previously, if I typed ~/bi
Tab, before, it would turn into ~/bin
. However, today it started turning ~/bi
Tab 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.
1 Answer 1
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
.
-
1The 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– njsg2013年01月24日 13:32:33 +00:00Commented Jan 24, 2013 at 13:32 -
1Red Hat derivatives do so too. The replacement configuration file
xxx
file is then calledxxx.rpmnew
if the configuration changes aren't critical; if the changes in configuration are really required, then the original is renamedxxx.rpmsave
andxxx
is the file from the package.vonbrand– vonbrand2013年01月26日 06:39:05 +00:00Commented 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 :|Justin L.– Justin L.2013年02月14日 21:24:20 +00:00Commented Feb 14, 2013 at 21:24