That won't work properly, it produces an error if there is more than one file in the directory. Also, hidden files are missed. A suggestion:
Code:
if [ -z "`ls -A $d`" ]; then
echo empty
else
echo not empty
fi
The [[ ]] command seems to be rarely used (at least in Bash). It can do string matching with the normal pathname expansion patterns that resemble primitive regular expressions. The [ ] command is more useful. Proper regular expressions can be handled with grep and sed, for example.
Here's a good Bash guide:
http://www.tldp.org/LDP/abs/html/index.html
Regards
Simon