bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] Save more readline state when running compgen


From: alex xmb ratchev
Subject: Re: [PATCH] Save more readline state when running compgen
Date: Tue, 21 Mar 2023 22:52:02 +0100

On Tue, Mar 21, 2023, 22:42 Grisha Levit <grishalevit@gmail.com> wrote:

> On Tue, Mar 21, 2023 at 5:26 PM alex xmb ratchev <fxmbsw7@gmail.com>
> wrote:
> > On Tue, Mar 21, 2023, 21:05 Grisha Levit <grishalevit@gmail.com> wrote:
> >>
> >> compgen -G 'foo/*' >/dev/null && COMPREPLY=(bar)
> >
> > i dont get that code at all , but i like idea of speedier file filling
> .. can u explain some in short ?
>
> Let's say you want to know if there are any entries starting with
> `foo' in the current directory.  You can do:
>

i see , thank you sir
i .. mostly dont have that case ( if existing n no more )
i always along the paths , to be used

GLOBIGNORE=
> shopt -s nullglob
> set +o noglob
> tmp=(foo*)
> if (( ${#tmp[@]} )); then ...
>
> Or you can do
>
> if compgen -G 'foo*' >/dev/null; then ...
>
> The latter doesn't care about nullglob / noglob / GLOBIGNORE and if
> the number of files is large can be a lot faster.


i wish i d knew all the compgen -opt switches

P.S. If you are interested in files that may or may not start with a
> dot, you do need to set dotglob in either case, which was the
> motivation for
> https://lists.gnu.org/archive/html/bug-bash/2023-03/msg00062.html


cool , hope for bugfix


reply via email to

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