On Tue, 2006-06-27 at 12:03 +0200, Tomas Larsson wrote:
Dear group.
How do I do to, within a scrip, check if a directory I empty or not.
Cant find a way to do this in a simple way.
DIR_CONTENTS=`ls $DIR`
if [ "$DIR_CONTENTS" == "" ]
then
echo "$DIR is empty"
else
echo "$DIR contains:"
echo $DIR_CONTENTS
fi
Cheers, Ben
With best regards
Tomas Larsson
Sweden
Verus Amicus Est Tamquam Alter Idem