4

How do I get bash to autocomplete when pressing TAB after an equality sign (=)? E.g. starting Abaqus, I use the command line

abaqus job=

and would like to be able to press TAB after '=' and get a list of files. Right now, I can insert a space after the '=', press tab to get a list of files, choose file and then remove the space.

I know about bash completion, but that way to much involved except if someone has an example of exactly how to do it.

5
  • 1
    Possible duplicate of How to stop bash being too smart restricting completion options?
    – muru
    Jun 27, 2019 at 6:52
  • @muru the answer to the purported dupe is way off: the user should either fix/define a cmake compspec, disable the programmable completion, or add back = to COMP_WORDBREAKS if it isn't already there (highly unlikely). There are a lot of other Qs from people fighting with bash's programmable completion, you'll have no problem finding a more suitable dupe ;-)
    – user313992
    Jun 27, 2019 at 7:47
  • @mosvy alt-/ still does work though, without all that fiddling.
    – muru
    Jun 27, 2019 at 7:49
  • @muru alt-/ is awkward and does not work when using vi mode. Tab is in the muscle memory, and people want to press Tab, not do finger gymnastics.
    – user313992
    Jun 27, 2019 at 7:51
  • This seems to be related.
    – mbomb007
    Nov 4, 2021 at 19:12

1 Answer 1

5

You should either go learn how to fiddle with bash's Programmable Completion (not for the faint of heart ;-)) or just disable it with

shopt -u progcomp

That you will get the classical readline(3) command / variable / filename completion back [1].

If the programmable completion is already disabled and =<Tab> still doesn't work, you should check the COMP_WORDBREAKS variable and add the = character to it if it isn't already included.

[1] for me the right fix on debian has always been

apt-get remove --purge bash-completion

which will uproot it completely, and prevent it from surreptitiously coming back.

1
  • Thank you! The shopt -u progcomp was exactly what I was looking for.
    – Carl
    Jun 27, 2019 at 10:11

You must log in to answer this question.

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