I have used this code 

```
#!/bin/bash

ls -l
echo -n "Number of simple files : "
ls -l | egrep '^-' | wc -l 
echo -n "Number of directories : "
ls -l | egrep '^d' | wc -l
echo -n "Number of hidden files : "
ls -la | egrep '^.*\.$' | wc -l
echo -n "Number of hidden directories : "
ls -la | egrep '^d.*\.$' | wc -l
echo " End"

```

While I can understand how the first two egrep work I can't figure out how the last
two work. More specific what does this mean `'^.*\.$'` ?
I want a file that starts with . (hidden file) and then how I should shape my regular expression?