Page 1 of 1

[SOLVED] (for 'tar' at least) How do I get the 'old' bash completion back?

Posted: Tue Jan 12, 2021 12:36 pm
by rosyth

Code: Select all

bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

Code: Select all

aptitude show bash-completion
Package: bash-completion                 
Version: 1:2.10-1ubuntu1
State: installed
Automatically installed: no
Multi-Arch: foreign
Priority: standard
Section: shells
Maintainer: Ubuntu Developers <>
Architecture: all
Uncompressed Size: 1,523 k
Provides: bash-completion:i386 (= 1:2.10-1ubuntu1)
Description: programmable completion for the bash shell
 bash completion extends bash's standard completion behavior to achieve complex
 command lines with just a few keystrokes.  This project was conceived to
 produce programmable completion routines for the most common Linux/UNIX
 commands, reducing the amount of typing sysadmins and programmers need to do on
 a daily basis.
I don't want to be an IT admin, I've got other things to waste my time on. So it frustrates me a bit when I end up spending an hour or more just to figure out why something that used to work pretty well now doesn't.

My problem here is with bash and tab completion.

Code: Select all

tar -z -tvf makbash: no match: --occurrence[=NUMBER]
Duh !!? hitting TAB after 'mak' gets this nonsense. It should expand to the file I want to look at, eg... manually typing

Code: Select all

tar -z -xvf make_boabab_run_as_root.tgz 
Instead of just expanding to all local file matches, tab completion seems to be a super bloated feature that does not even have the decency to fail gracefully.

I see 122037 lines of configuration files !!! in /usr/share/bash-completion/completions/* including >700 lines for tar.

Really? I don't remember a great clamour from desperate Linux users for a 'better' tab completion.

So ... rant over....
How do I get the simple tab completion back?
Is it simply uninstalling 'bash-completion' ? Or will that mess up everything?
I don't really need all the bells and whistles like argument expansion etc etc. But I do want it to work when I need it.
This isn't the first command that I've found it impossible to simply expand out to the file name I want.

UPDATE.... I give up, it's a complete waste of time trying to unravel the code spaghetti in the tar completion file. So here's my regression 'back to normal'

At the top of '/usr/share/bash-completion/completions/tar'
I've stuck in the following code lines,

Code: Select all

function _tar { :; }
complete -F _tar        -o dirnames tar
And I seem to be back to the good old days of linux. :D