3

Using bash on this this system:

Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux

The sequence:

cd /tmp
touch test1.txt && touch test2.txt && touch test3.txt
ls test [tab][tab]

Shows:

test1.txt test2.txt test3.txt

below the command line.

That is how I expect bash autocomplete to behave.

But when I type:

ls test* [tab][tab]

(expecting the same result) I only get (I.e. autocomplete exclusively expands to):

test1.txt

So the asterisk (*) wildcard at the end makes test[23].txt 'unreachable'. I'm pretty sure the two sequences used to give the same results in previous versions of bash -- at least on my computer.

Does anyone else have this problem? Is it a default setting (e.g. in Debian 8) that can be changed? (I tried to set and unset different shell parameters with shopt but to no avail).

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
alle_meije
  • 305
  • 1
  • 2
  • 14

1 Answers1

0

Well the solution that works for me is this: in ~/.bashrc I had the lines

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
   if [[ -f /usr/share/bash-completion/bash_completion ]]; then
      . /usr/share/bash-completion/bash_completion
   elif [[ -f /etc/bash_completion ]]; then
      . /etc/bash_completion
   fi
fi

That is the block I thought takes care of the autocompletion. After commenting it out and starting a new shell though, not only does it work but it has gone back to the way I am used to!

Still not sure what the if-clause means but I won't try to fix it while it works..

alle_meije
  • 305
  • 1
  • 2
  • 14
  • Would be nice if you described what this actually does or where it comes from. – Ross May 05 '20 at 02:23
  • I think I copy pasted it from a post, perhaps https://askubuntu.com/questions/103655 - but I did say in the post that I don't know what it means... – alle_meije May 06 '20 at 16:24