Unwanted blank after command line <tab> expansion

Ralf Mardorf kde.lists at yahoo.com
Sun Sep 4 14:36:36 UTC 2022


On Sun, 2022-09-04 at 22:25 +1000, Karl Auer wrote:
> Someone who uses custom completions should be able to work out from the
> man page (and definitely from my explanation) how to turn off that
> pesky space. And do other neat things with completions as well.

Hi,

I don't see Mark mentioning custom completions. My understanding is that
he wants to get rid of a single default behaviour and keep all other
default behaviours.

While Arch Linux and Ubuntu should both be partly POSIX and partly apply
to a kind of idea of a Linux standard base, the most common login shell
used by Linux distros shouldn't differ too much, too.

However, I'm using Ubuntu, too. At the moment I only have access to

[weremouse at moonstudio ~]$ lsb_release -rc
Release:	16.04
Codename:	xenial

End of Life April 2026, see https://wiki.ubuntu.com/Releases . It
behaves like this:

[weremouse at moonstudio ~]$ ls -hAl $HOM
expands to
[weremouse at moonstudio ~]$ ls -hAl $HOME 
                                       ^with a space after the E
[weremouse at moonstudio ~]$ $HOM
becomes
[weremouse at moonstudio ~]$ $HOME/
                                ^without a space after the /

My understanding is, that the OP wants that "ls -hAl $HOM" becomes
"ls -hAl $HOME/", so he can continue typing "ls -hAL $HOME/Desktop"
without the additional step, to use the backspace key first.

IOW this behaviour is equal for at least an up-to-date Arch Linux,
Ubuntu 16.04 and the Ubuntu release used by the OP. If it's different
for any other Ubuntu release or not doesn't matter. In my understanding
the OP asked how to change this. IOW until now no custom completion is
used, it's the default.

Disclaimer: That I don't understand your example, doesn't mean the OP
also doesn't understand it.

I suspect I understand what you explained related to
"complete -o nospace -F _totp totp". I might be mistaken.

I don't understand how to use this to change the default behaviour for
usage of "ls", "cp" and other commands.

Regards,
Ralf




More information about the ubuntu-users mailing list