Gentoo Archives: gentoo-server

From: Ben Munat <bent@×××××.com>
To: gentoo-server@××××××××××××.org
Subject: Re: [gentoo-server] simple shell script
Date: Sat, 02 Apr 2005 21:52:00
Message-Id: 424F162D.30301@munat.com
In Reply to: Re: [gentoo-server] simple shell script by Renzo Rosales
1 Thanks. That should be -ne 0 (without the quotes), right?
2
3 b
4
5 Renzo Rosales wrote:
6 > You can do an if statement to check if the number of files of a
7 > directory listing is greater than 0:
8 > if [ `ls $mydir -1 | wc -l` -ne "0" ]
9 > then rm ${mydir}/* -rf
10 > fi
11 >
12 > list /path/to/dir using a single column (-1) and do a word count (wc)
13 > based on the amount of lines (-l)
14 > --
15 > gentoo-server@g.o mailing list
16 >
17 --
18 gentoo-server@g.o mailing list