Re: [PATCH] Save more readline state when running compgen
From:
Grisha Levit
Subject:
Re: [PATCH] Save more readline state when running compgen
Date:
Tue, 21 Mar 2023 18:31:23 -0400
On Tue, Mar 21, 2023 at 5:52 PM alex xmb ratchev <fxmbsw7@gmail.com> wrote:
> On Tue, Mar 21, 2023, 22:42 Grisha Levit <grishalevit@gmail.com> wrote:
>> 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
The most common use case would probably be to see if a directory is
empty or not, like:
compgen -G 'dir/@(*|.*)' >/dev/null || echo 'dir is empty'
I don't see it mentioned in https://mywiki.wooledge.org/BashFAQ/004
but I think it's nice because you don't need subshells and don't have
to fiddle with shopt, etc.