You are relying on (whatever shell you are using) to do glob expansion.
ls -lah | grep \.foo
.. might help you sort that out in a portable way.
user@tower:~ ls -lah | grep \.mozilla
drwx------ 3 root root 4.0K 2007-11-14 06:17 .mozilla
Behold, the power of pipes :) Expanding that is an exercise for the reader. shopt is not portable and on systems that use a strictly POSIX shell (such as dash) it breaks. Better to write it simply, and portably .. or you'll upload your tried and true script to a box running some other distro and watch it break, horribly.
NB, each shell does glob expansion in its own way, broadly determined by its license. Please, please, please avoid bashisms. Ubuntu spent tens of thousands of dollars getting rid of those in their product.