Re: [Help-bash] Command completion with * in the middle?
From:
Peng Yu
Subject:
Re: [Help-bash] Command completion with * in the middle?
Date:
Tue, 22 Jan 2019 11:26:57 -0600
> > I think something like this does the trick?
> >
> > f() { COMPREPLY=($(compgen -c -X '!'"$3")); }
> > complete -I -F f -o bashdefault
> >
> > i.e. generate all commands and then remove the ones that don't match the
> > pattern supplied.
>
> Ooh, that's clever.
For some reason, this code does not work for me.
For example, when I type b*sh, then type TAB, it just clears up the
command line by deleting "*sh". I only end up with "b" in the command
line. Do you know what is wrong? Thanks.
--
Regards,
Peng