Hide Forgot
Description of problem: I have a directory on my system named /zooty/ I'm sitting in a terminal and type cd /zoo Then hit TAB. I see this nonsense: zooty> cd /zoobash: cd: cd: No such file or directory /home/tom/ Version-Release number of selected component (if applicable): bash-completion-1.3-6.fc16.noarch How reproducible: Every time Steps to Reproduce: 1.see above 2. 3. Actual results: nonsensical error spewing out at the point where I hit TAB Expected results: Completion of the /zoo partial name to /zooty Additional info: If I remove /etc/profile.d/bash_completion.sh, and re-login, everything starts working fine again.
I can't reproduce. Please do a "set -x" in a terminal, then invoke the "cd /zoo<TAB>", capture the output in a file and attach it here. Also, is the behavior always the same no matter which dir you're in when invoking the completion?
It seems to work fine if I comment out these definitions in my .bashrc file: function _pwd () { echo $PWD/ } function _cd () { 'cd' "$@" > /dev/null _pwd } alias cd=_cd (I like the cd command to tell me the full path name of where I just wound up, very handy for current directory tracking in an emacs shell). With those defined, this is what set -x shows: zooty> set -x zooty> cd /zoo+ cd cd /zoo cd bash: cd: cd: Not a directory + _pwd + echo /home/tom/ /home/tom/ Without those .bashrc defs, a humoungous set of shell gibberish is printed, but /zoo does, in the end, get expanded to /zooty/
The function bash-completion uses for completing the cd command is also called _cd, and your bashrc definition overrides it with an incompatible one. There has been some talk upstream to introduce a "namespace" for everything bash-completion uses/defines to make clashes like this less likely to happen (e.g. prefix all of its functions with _bashcomp_), but it is not clear when that might be implemented if at all. I suggest renaming your _cd function so something else that doesn't clash with bash-completion. By the way I believe your bashrc setup could be simplified to something like this, no need for aliases or other functions for this purpose: cd() { builtin cd "$@" > /dev/null ; echo $PWD/ ; }