Bash tab autocomplete adds backslash before equal sign

example (look at last row):
key text after press key
openSUSE Tumbleweed Linux Mint 22
c linux@vbox:~> c mint@mint:~$ c
p linux@vbox:~> cp mint@mint:~$ cp
space linux@vbox:~> cp mint@mint:~$ cp
- linux@vbox:~> cp - mint@mint:~$ cp -
- linux@vbox:~> cp -- mint@mint:~$ cp --
t linux@vbox:~> cp --t mint@mint:~$ cp --t
tab linux@vbox:~> cp --target-directory\= mint@mint:~$ cp --target-directory=
How to make bash tab autocomplete in openSUSE Tumbleweed not add \ before = like in Linux Mint?

I do not know what the picture you show is from. I have no idea about Linux Mint. And it might look a bit strange, but does it not function?

I do not know what the picture you show is from.
Table is from me pressing keys in terminal and copy+pasting all text from terminal.
And it might look a bit strange, but does it not function?
\ before = is bad because if I have cp --target-directory\=/t (cursor at the end) and I press tab, I get cp /tmp/ (both in openSUSE Tumbleweed and Linux Mint 22 but bash tab autocomplete doesn't add extra \ in Linux Mint 22).

Use -t instead of --target-directory=
--target-directory\= is maybe an bug?

Yes maybe as in: not the intention. But I think the resulting command will still function as if the \ wasn’t there.

But I think the resulting command will still function as if the \ wasn’t there.
Yes, program = and program \= are same. \ just makes tab autocomplete annoying.

I understand. Maybe file a bug?
Information: openSUSE:Submitting bug reports - openSUSE Wiki
And the place to do it: Bugzilla Main Page (same username/password as here on the forums).

I found what made bash tab autocomplete weird!
It was 2 openSUSE-specific bash-completion patches that turn on filenames comp-option:
bash escapes = if filenames comp-option is on:
  1. run
    complete -W = dummy1
    complete -o filenames -W = dummy2
  2. type dummy1 (space is important) and press tab
    you get dummy1 =
  3. type dummy2 (space is important) and press tab
    you get dummy2 \=

I am not sure if the present behaviour was the intention of the patches. Did you start a bug report pointing to what you experience?

Just curious and I tested with a file name:

henk@boven:~/test/co> touch aap=noot
henk@boven:~/test/co> l
total 8
drwxr-xr-x  2 henk wij 4096 Aug 26 10:33 ./
drwxr-xr-x 11 henk wij 4096 Aug 26 10:33 ../
-rw-r--r--  1 henk wij    0 Aug 26 10:33 aap=noot
henk@boven:~/test/co> rm aap\=noot

where I hit the Tab somewhere within aap. So it uses the \ for completion, but I (like you) have no idea why. I see no reason to escape the = at all.

https://bugzilla.opensuse.org/show_bug.cgi?id=1229795

Thanks. I am curious to follow this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.