On 14 Nov 2018, Vincent Danjean wrote:
>3) experiments
> $ ssh k[tab] # => autocomplete in kooot+eyak, ok
> $ ssh kooot+aya # => no auto-completion on first try, normal
> $ ssh k[tab] # => autocomplete in kooot+
> $ ssh kooot+e[tab] # => autocomplete in kooot+eyak, ok
> $ ssh kooot+a[tab] # => no autocompletion
Reproduced. :)
>4) patch /usr/share/bash-completion/bash_completion
> sudo vi /usr/share/bash-completion/bash_completion
I didn't patch the file with your proposed change, instead, I backported
the patch that Ville mentioned in his reply.
>5) source /etc/bash_completion
>
>5) experiments
> $ ssh kooot+a[tab] # => autocomplete in kooot+aya, works now
It also works with the backport. :)
> # Remove trailing ] + optional :port
> host="${host%]?(:+([0-9]))}"
>
>I'm under the impression that, with IPv6 address, it will remove
>the last part of it (not tested, I may be wrong). But in my known_hosts
>file, I've some entry such as:
>XXXX:YYYY:ZZZZ:100::1 ecdsa-sha2-nistp256
I added a similar entry to my ~/.ssh/known_hosts, then tried to
complete with:
$ ssh XXX[TAB]
$ ssh XXXX:YYYY:ZZZZ:100::1
Unless I did not understand your concern, I think it works as
expected. So, I'll go ahead and backport the patch for the next
version of Debian's bash-completion.
> I hope this help.
It absolutelly helped.
Thank you so much,
Gabriel