On Wed, Feb 21, 2007 at 12:49:13PM +0000, Paul wrote:
On Wednesday 21 February 2007 11:42, Eur Ing Chris Green wrote:
What's the simplest (and/or most concise) way to check for an empty directory?
if test -z `ls foo` ; then wibble ; fi
Or
if [ -z `ls foo` ] ; then wibble ; fi
That's neat! It's not actually perfect because hidden files in the directory will break it, but it's perfect for my application as I don't care about hidden files.
There's probably other ways....
No doubt, but the above will do very well, thanks (and for all the other ideas).