[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: test im script



Am Samstag, 10. Juli 2004 19:24 schrieb Bjoern Schmidt:
> On Sat, 10 Jul 2004, Heike C. Zimmerer wrote:
[...]
> > > if [ -z "$(find /voller/pfad -type d -empty -maxdepth 0)" ];
> > > then
> >
> >           ^                                    ^^^^^^^^^^ ^
>
> Werde ich umgehend aendern. Hoffe dann ist es endlich richtig...
> ;) Danke fuer den Hinweis!

Eine andere Alternative wäre stat:
if test `stat -c %h "/voller/pfad"` -eq 2; then
  ...
fi

Ein leeres Verzeichnis hat immer exakt 2 Links - einmal auf .. und 
einmal auf .

Jan

-- 
Linux-Quickies: http://www.jan-trippler.de
PingoS: http://www.pingos.org



Reply to: