Gentoo Archives: gentoo-server

From: Renzo Rosales <rrosales@×××××.com>
To: gentoo-server@××××××××××××.org
Subject: Re: [gentoo-server] simple shell script
Date: Sat, 02 Apr 2005 21:36:07
Message-Id: 79c4d9ee05040213365b2dde49@mail.gmail.com
In Reply to: [gentoo-server] simple shell script by Ben Munat
1 You can do an if statement to check if the number of files of a
2 directory listing is greater than 0:
3 if [ `ls $mydir -1 | wc -l` -ne "0" ]
4 then rm ${mydir}/* -rf
5 fi
6
7 list /path/to/dir using a single column (-1) and do a word count (wc)
8 based on the amount of lines (-l)
9 --
10 gentoo-server@g.o mailing list

Replies

Subject Author
Re: [gentoo-server] simple shell script Ben Munat <bent@×××××.com>