help-bash
[Top][All Lists]
Advanced

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

Re: default/simple globbing


From: #!microsuxx
Subject: Re: default/simple globbing
Date: Thu, 28 Nov 2024 21:48:32 +0100

for d in $( ls --hide='*[:.]*' --hide='[!0-9]*' /sys/bus/usb/devices/ ) ;
do echo "$d" ; done

On Thu, Nov 28, 2024, 9:15 PM Chris Elvidge <celvidge001@gmail.com> wrote:

> On 28/11/2024 at 19:56, Lawrence Velázquez wrote:
> > On Thu, Nov 28, 2024, at 8:56 AM, Chris Elvidge wrote:
> >> ls --hide='*:*' --hide='*.*' -l /sys/bus/usb/devices/
> >
> > As mentioned in a subsequent message, OP was using ls as an example;
> > the actual context is generating filenames for a loop.
> >
> > (In general, I wish people would stop trying to "simplify" their
> > questions like this, but that's neither here nor there.)
> >
>
> If s/he wants to generate the filenames s/he should be using an array,
> surely?
> e.g. files=(/sys/bus/usb/devices/*)
> and then : for f in ${files[@]}; do check $f && dowhatever; done
>
> --
> Chris Elvidge
> England
>
>
>


reply via email to

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