Shell expansion of * and hidden files

James Wilkinson james at westexe.demon.co.uk
Fri Jul 23 12:30:16 UTC 2004


Robert P. J. Day wrote:
> it's a popular puzzle to come up with a glob that matches all 
> hidden thingies, without matching "." or "..".  and the solution is 
> ...
> 
> $ echo .[!.]*

Andre Speelmans objected:
> But this would miss the file ..test or any other which starts with two or more
> dots.
> 
> And I have to admit I don't know which glob would match all :(

Try
echo .[!.]* ..?*
which should overcome that ojection. It even handles ".. ".

Now the next objection to that glob (er, technically, those globs) is
that they don't necessarily return files in the local collating
sequence...

Anyone? ;-)

james.
-- 
E-mail address: james@ | "OPENING LINES OF THE 23RD PSALM
westexe.demon.co.uk    | Original version:
                       | The Lord is my Shepherd, I'll not want."
                       |     -- "The Independent" thinks David spoke English





More information about the fedora-list mailing list