2

I'm used to typing ls Doc, and tabbing a couple times to complete to ls Documents/.

However, now my ls is completing that same statement to ls Documents with a space at the end of Documents, so I can use it to find my way through the file tree.

This started happening today. Any ideas why and more importantly, how to fix?

Edit

This happens for ANY and ALL directories. Documents was an example. $CDPATH is empty.

complete | grep ls returns complete -o default -F _longopt ls as the only relevant answer.

locate Documents turns up stuff in /usr/lib/

2
  • Is there a file in the current directory (where you are trying to perform the complete from) named "Documents"? Does it act the same way in/for other directories? Commented Feb 21, 2012 at 21:45
  • Yes, it behaves uniformly in every folder. Documents is a folder, there are no similarly named files. This also isn't a result of a .bashrc causing issues. I've made no changes to it, and moved it out of the way temporarily but that hasn't helped
    – EricR
    Commented Feb 21, 2012 at 21:50

2 Answers 2

2

There are a couple things that may be happening.

1) do complete | grep ls and see if there are any special completions for ls. There may be code that is changing what you expect completion to do

2) do echo $CDPATH This variable is a list of special directories that bash will look for, outside of the local directory, for cd. I'm not sure if ls uses this, but worth a try.

You can also try locate Documents and see if you find a directory that it may be trying to reference.

EDIT

It looks like you're using the bash_completion package. It tries to run the function _longopt when you ask for completion. Try complete -f ls and see if ls now behaves as you expect.

4
  • Attempted all of these. I'm not sure what I should expect from complete's output and have edited my question to reflect this.
    – EricR
    Commented Feb 21, 2012 at 23:33
  • Thank you so much. This solved it. Now to figure out where that setting got changed.
    – EricR
    Commented Feb 21, 2012 at 23:43
  • @EricR look for the bash_completion package, you may have that installed. Check out /etc/profile and /etc/profile.d Commented Feb 22, 2012 at 16:55
  • I'm writing this for future reference. I ended up finding a line in /etc/bash_completion which specified -F _longopt which I changed to read -f which solves my problem completely
    – EricR
    Commented Feb 22, 2012 at 19:00
1

Based on your description, the only scenario that makes sense is that some time in the past Documents was a symlink that pointed to some directory, and today Documents is still a symlink but pointing to one of the following:

  1. something that is not a directory.
  2. something that no longer exists.
  3. something that you can't access enough to determine if it is a directory or not.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .