On Wed, Nov 27, 2024 at 12:55:47PM +0100, lacsaP Patatetom
(patatetom@gmail.com) wrote:
> hi,
>
> I try to display only part of the `/sys/bus/usb/devices/` folder with `ls
> /sys/bus/usb/devices/*-*[!.:]*` or `ls /sys/bus/usb/devices/*-*[^.:]*` but
> it doesn't subtract entries with a dot or colon in their name (only usb
> entries are removed).
You can't really subtract things with glob patterns. In your pattern
the problem is that * matches dots and colons as well, so the impact
of *[!.:]* is only that there has to be at least one character other
than a dot or colon, but there may be any number of them as well.
> if it's possible, what is the correct expression to use without having to
> activate extended globbing ?
I'm afraid there isn't any. If you can limit the set of desired names
you may be able to get what you want with multiple patterns, e.g.,
ls *-[0-9] *-[0-9][0-9]
Otherwise you can of course do strange things with additional
commands, variable expansion &c, which might be useful depending on
your application. Just for display simply ls | grep -v '[:.]' might do.
Is there a reason why you don't want to use extended globbing?
--
Tapani Tarvainen