I don't like using ls because I have some very large directories and I hate wasting the resources to fill a pipe with all that stuff.
I don't like filling a $files variable with all that stuff either.
So while all of @libre's answers are interesting, I find them all unreadable, and prefer to make a function of my favorite, the 'find' solution:
function isEmptyDir {
[ -d $1 -a -n "$( find $1 -prune -empty 2>/dev/null )" ]
}
So that I can write code that I can read a year from now without asking "what was I thinking"?
if isEmptyDir some/directory
then
echo "some/directory is empty"
else
echo "some/directory does not exist, is not a directory, or is empty
fi
or I can use additional code to tease apart the negative results, but that code
should be pretty obvious. In any case, I'll know right away what I was thinking.