Shell expansion of * and hidden files

Robert P. J. Day rpjday at mindspring.com
Fri Jul 23 09:18:56 UTC 2004


On Thu, 22 Jul 2004, Alan Horn wrote:

>
> On Thu, 22 Jul 2004, Ulrich Drepper wrote:
>
>> The most straight-forward way is to tell the shell you want the dot files:
>> 
>> $ ls -a
>> ./  ../  .uu
>> $ echo *
>> *
>> $ shopt -s dotglob
>> $ echo *
>> .uu
>> $ shopt -u dotglob
>> $ echo *
>> *
>> 
>
> I find that
>
> ls .??*
>
> usually works well.

actually, it doesn't, since it wouldn't match the perfectly valid 
".a".  it's a popular puzzle to come up with a glob that matches all 
hidden thingies, without matching "." or "..".  and the solution is 
...

$ echo .[!.]*

why it works left as an exercise for the reader.

rday





More information about the fedora-list mailing list