[ALUG] How to check a directory is empty (probably in bash)?

Paul lists at bulldoghome.com
Wed Feb 21 12:49:13 GMT 2007


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

There's probably other ways....


Regards, Paul.




More information about the main mailing list