Bash tab completion adds extra space after the first completion

Viewed 6812

Bash tab completion adds extra space after the first completion which stops further completion if the compeletion target is a file in multi-level folders.

For example, I have a file in the path ~/Documents/foo/bar.txt, and I want to list it. I face the following problem, when input

a@b:~$ls Docu <TAB>

I get

a@b:~$ls Documents |(<-this is the cursor, so there is an extra space afer Documents)

So I cannot further tab complete. I have to backspace to delete the extra space.

Normally I want to get:

a@b:~$ls Docu <TAB>
a@b:~$ls Documents/ <TAB>
a@b:~$ls Documents/foo/ <TAB>
a@b:~$ls Documents/foo/bar.txt
4 Answers
Related