Path: utzoo!mnetor!uunet!husc6!linus!philabs!micomvax!cmtl01!mdorion
From: mdorion@cmtl01.UUCP (Mario Dorion)
Newsgroups: comp.unix.questions
Subject: Re: Empty Directory? (Was: Picking a character from a word)
Message-ID: <304@cmtl01.UUCP>
Date: 8 May 88 02:15:57 GMT
References: <13241@brl-adm.ARPA>
Lines: 22

In article <13241@brl-adm.ARPA>, rbj@icst-cmr.arpa (Root Boy Jim) writes:
> 	   set nonomatch
> 	   if ( ! -e $dir/* ) echo $dir is empty.
> 
> Didn't work under 4.3 BSD. How about a two-step solution?
> 
> 	ls -A $dir > /tmp/$$
> 	if ( -z /tmp/$$ ) echo directory empty

Wouldn't
        if [ `ls -a $dir | wc -w` -eq 2 ]  \* for . and .. *\
        then echo $dir is empty
        fi
work ?????

BTW: what does "set nonomatch" do ???

-- 
     Mario Dorion              | ...!{rutgers,uunet,ihnp4}!     
     Frisco Bay Industries     |            philabs!micomvax!cmtl01!mdorion
     Montreal, Canada          |
     1 (514) 738-7300          | I thought this planet was in public domain!