Shell expansion of * and hidden files

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


I wrote that it's not easy to come up with a glob pattern that matches
all hidden and non-hidden files without matching the special cases
of "." and "..".

And Ulrich Drepper replied:
> 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 *
> *
> 
And, as long as you're using bash, it works! (Am I showing my time on
other Unices here?)

Wow, thanks. I didn't know you followed this list...

James.
-- 
E-mail address: james@ | "Come on, son, give us your best shot."
westexe.demon.co.uk    |     -- Goliath





More information about the users mailing list