man bash says:

completion-map-case (Off)

If set to On, and completion-ignore-case is enabled, readline treats hyphens (-) and underscores (_) as equivalent when performing case-insensitive filename matching and completion.

$ bind -v|grep case
set completion-ignore-case on
set completion-map-case on

When I type

$ touch _test
$ chmod +x -t<TAB>

it completes to

$ chmod +x _test

But neither

$ ./-t<TAB>
$ ls -t<TAB>


Why is that and can it be fixed?

  • 1
    Try after shopt -u progcomp. I don't think that those settings work with the "programmable completion" which is now the default on many systems.
    – user313992
    Commented Jan 19, 2021 at 10:37
  • Thanks! This works for the ls -t case but it still does not complete ./-t
    – laktak
    Commented Jan 19, 2021 at 10:39
  • 1
    That seems broken. I suggest you submit a bug report.
    – user313992
    Commented Jan 19, 2021 at 10:48
  • OK I'll run bashbug
    – laktak
    Commented Jan 19, 2021 at 11:19

1 Answer 1


Chet Ramey replied to my report:

Thanks for the report. Those two options work for filename completion, but not command completion (the bulk of which is handled outside readline). I'll take a look at exposing that functionality outside readline, since it's currently part of readline's filename completion, but that will take some time and probably require a version bump.

You must log in to answer this question.

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