help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exclude builtins from command completion


From: kaycee gb
Subject: Re: Exclude builtins from command completion
Date: Thu, 23 Jan 2020 13:58:07 +0000

Le Sat, 18 Jan 2020 20:06:54 +0100,
František Kučera <address@hidden> a écrit :

> Dne 09. 01. 20 v 21:17 kaycee gb napsal(a):
> > After playing with options for complete -b/-c, compgen -b/-c, these
> > commands are still displayed when I type first 2 letters then <TAB><TAB>
> >
> > # sh<TAB><TAB>
> > shift shopt show
> >
> > I want that it matches just the last one. 
> 
> Hello,
> 
> I am dealing with a similar issue. I need a bash-completion that suggest only
> commands from a special path variable (similar to $PATH, may also contain
> multiple directories) and I need to get rid of shell builtins and function
> names i.e. return only executable files on my path.
> 
> My current solution is:
> 
> while read c; do PATH="$MY_PATH" type -P "$c" &>/dev/null && echo $c; done <
> <(PATH="$MY_PATH" compgen -A command -- "$input")
> 
> It is bit complicated but does exactly what I need.

Yes it seems a bit more complicated than mine ^^
At which level do you insert your code ? 
> 
> Franta
> 
> 
> 
> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]