Sunday, June 15, 2008

How to disable tilde expansion on bash, Ubuntu 8.04 (hardy)

This is how to prevent bash from replacing "~" with "/home/" when you auto-complete using .

1) Edit .bashrc
prompt%> cd
prompt%> vi .bashrc

2) Add the following lines:

# Disable Tilde Expansion
return 0;

3) Try it out on a new terminal

For those interested, see: /etc/bash_completion Look for "tilde".



Anonymous said...

Thanks, was really annoyed by the automatic expansion :)

Anonymous said...

Better to use:

_expand() {
eval cur=$cur

To keep auto-completion of e.g. "unzip".