Re: Checking if directory is empty in postrm
*-Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
|
| I need something that returns an error code if the directory is empty but
| does return 0 if it is non-empty.
I don't know how portable this is, but this seems to work for
me in bash:
test -d empty -a $(ls -l empty | wc -l) -eq 1
This returns 0 if "empty" is a dir and it is empty.
--
A mathematician is a machine for converting coffee to theorems
(Erd\H{o}s Pál)
olet@ifi.uio.no [-: .elOle. :-] olet@debian.org
Reply to: