Re: Bash problems?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux