testing if a directory is empty (OOOPS!)

Paul Barton-Davis pauld at cs.washington.edu
Tue Apr 16 05:55:13 AEST 1991


Oops - correction to previous posting

i didn't bother to check the logic of the echo, i just
shortened the syntax. in fact, the whole idea is broken:

	$ mkdir x
	$ cd x
	$ files=`echo *`
	$ echo $files
	*

So it needs to be:

	[ "`cd $1 ; echo .??* *`" = ".??* *" ]

this picks up a dot files too (anyone who has a dot file called ".a"
should be taken out and shot :-)
-- 
Paul Barton-Davis			<pauld at cs.washington.edu>
UW Computer Science Lab		``to shatter tradition makes us feel free''



More information about the Comp.unix.questions mailing list