On Jul 29 11:44:32, develo...@robert-palm.de wrote:
> > On Jul 29 09:47:39, develo...@robert-palm.de wrote:
> > > wonder how I can get TAB completion in the shell when using doas ...

echo $SHELL
Different shells do (or don't) this differently.

> > tab completion is not specific to any command.
> 
> Hm, it does work, e.g. when I start typing
> 
> $sysu<TAB>
> 
> it shows me the commands starting with "sysu"

Yes. That is not specific to sysupgrade.

> But I would like this to happen even if I use
> 
> $doas sysu<TAB>

If I am not mistaken, command names are only completed
as the first (zeroth) argument. Doing this for the second argument
would be doas-specific: the shell would need to know that while
a command (doas) has already been given, there is still another
command to be given, because the first is doas; in other words,
the shell would need to know the semantics of the (first) command,
which it doesn't. For the > first argument, file names are completed
instead, as that is a typical argument to a command (already given).

> There seems to be a solution for the bash shell (adding following to
> ~/.bashrc)
> 
> complete -cf doas
> 
> but I cannot figure out how to do this for ksh.
> 
> My workaround is to type in the command (using autocompletion) and then jump
> to the beginning of the shell again adding doas in front of the cmd.
> 
> But it would be nice to start with doas and then simply typing in the cmd...

Why stop here? It would be "nice" if tab-completion would complete
the hostnames from ~/.ssh/known_hosts when you have already said 'ssh';
some shells do that, the OpenBSD ksh doesn't.
It is the opposite of siplicity.

Reply via email to