群里有朋友问我如何检查一个目录是否为空目录

#!/bin/bashDIR=$1if [ "$(ls -A $DIR)" ]; thenecho "$DIR is not Empty"elseecho "$DIR is Empty"fi

enjoy it!