Checking a directory is empty

#!/bin/bash
if [ "$(ls -A $1)" ]; then
    echo "$1 not empty"
else
    echo "$1 is empty"
fi
This entry was posted in unix. Bookmark the permalink.