On 16/03/2021 03.49, David Haller wrote:
Hello,
[@David T-G: thanks, glad to have helped :)]
On Tue, 16 Mar 2021, Carlos E. R. wrote:
On 16/03/2021 01.32, David Haller wrote:
On Mon, 15 Mar 2021, David T-G wrote: [..]
Hmmmm ... Do char classes work for ls for you? Not for me on Leap 15.2:
diskfarm:/tmp/X # ls -la -rw-r--r-- 1 root root 0 Mar 15 22:27 .abc -rw-r--r-- 1 root root 0 Mar 15 22:27 .x diskfarm:/tmp/X # ls -la .[:alnum:]* -rw-r--r-- 1 root root 0 Mar 15 22:27 .abc diskfarm:/tmp/X # ls -la .[:alnum:] ls: cannot access '.[:alnum:]': No such file or directory [..] Correct is: 'ls -la .[[:alnum:]]*'
No, it looks inside subdirectories.
So what? Just use the '-d' option to ls. It wasn't specified not to. The question/confusion was about how to use char-classes in wildcards aka globs, i.e. that you need to use '[' and ']' around the '[:charclass:]' string for globbing... Whether just that (e.g. '[[:alnum:]]') or combined with other stuff (e.g.: '[^[:alnum:], _-]') does not matter.
The non-"problem" with "looking into subdirs" appears with _any_ wildcard, c.f. 'ls -lA *' or 'ls -lA a*' or 'ls -lA .c*' or whatever.
I know nothing about char-classes and it is not something I will likely learn, sorry. To me the problem is simply listing hidden files in one directory. -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)