On Tue, Mar 21, 2023 at 5:52 PM alex xmb ratchev <fxmb...@gmail.com> wrote: > On Tue, Mar 21, 2023, 22:42 Grisha Levit <grishale...@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.