3

Somewhere along the way I've fallen into the habit of hitting tab twice after using a wildcard in commands like mv or rm, which by default causes bash to show the list of files that would match the wildcard expansion. For example:

  {~/bin}-> ls p*<TAB>
  pnuke         pscp          pssh          
  prsync        pslurp        pssh-askpass  

However, when using the bash_completion package in Debian Jessie, this behavior has changed, and the default behavior when completing a filename is to replace any wildcards with the first (and only the first) file that matches the expansion. With bash_completion installed, if I use the same example as above, my command line changes to look like this after hitting tab:

  {~/bin}-> ls pnuke

Of all the possible actions bash could have taken in this situation, this seems like the least useful. Is there a way to get back the default readline file completion behavior, while still getting all the other goodies that bash_completion provides when completing something that is not a file name? Or if not the default behavior, can I at least make it do something helpful? (Even doing nothing at all would be more helpful behavior than this.)

0

Did you know you can get the desired behavior by typing ls p + Tab instead of ls p* + Tab?

Alternatively you can type ls p* + Alt - ! or ls p* + Ctrl - x + !.

Note that Alt - ! and Ctrl - x + ! are bound to complete-command and possible-command-completions, respectively. You can rebind Tab to complete-command via bind '\C-i:complete-command'. This will give you your desired glob expansion but will probably screw up completion for other things.

Hopefully there is a better solution. If I knew what version of Bash introduced the change, I'd have a better chance of finding one.

0

The bash version isn't very relevant, this behaviour is part of bash-completion, a separate project.

uninstalling this package or editting its config files will give you the desired default behaviour

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.