1

I've looked at a lot of bash tab completion questions and haven't yet found one that answers this one.

I'm on a linux system (GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)) and normally tab completion works just fine.

However, when I go to use tab completion for an environment variable or command-line option, it fails. For example,

ls /v<TAB> -> ls /var/
export FOO=/v<TAB> -> export FOO=/v (bell plays)

When I do this on my Mac (GNU bash, version 5.0.16(1)-release (x86_64-apple-darwin18.7.0)) tab completion of the environment variable value works fine.

On both machines, $COMP_WORDBREAKS is "'><=;|&(:.

Someone (I don't know where this came from) suggested that

shopt -u progcomp

might help, and it does fix the problem! However, I don't need to unset that option Mac-side and I'm worried it might cause other strange side effects.

Is that a normal thing to unset? Is there anything else I can do to figure this out?

1
  • Blabla= requires anything whatsoever to follow. What should the completion suggest?
    – vonbrand
    Mar 2, 2020 at 2:00

1 Answer 1

1

shopt -u progcomp disables programmable completion, i.e. scripts that may provide e.g. per-program completion. They might provide features like only completing files that match *.tar or such when the command line starts with tar, etc. Those scripts usually come with your distribution, or not, in the case of the Mac.

It's fine to disable progcomp if the bugs and misfeatures caused by those scripts seem more annoying than the actual features are useful (and for me, that's about 100 % of the time).

1
  • Thank you — that both reassures me that things are okay and gives me somewhere to look for something broken. If turning off progcomp makes this work correctly, then it's a pretty good bet that something is borked with those rules.
    – Nate
    Mar 2, 2020 at 19:35

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.