From owner-freebsd-questions@FreeBSD.ORG Fri Feb 4 19:54:54 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E55EA16A4CE for ; Fri, 4 Feb 2005 19:54:54 +0000 (GMT) Received: from chen.org.nz (chen.org.nz [210.54.19.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FAD043D3F for ; Fri, 4 Feb 2005 19:54:54 +0000 (GMT) (envelope-from jonc@chen.org.nz) Received: by chen.org.nz (Postfix, from userid 1000) id 7C8F75647A; Sat, 5 Feb 2005 08:54:52 +1300 (NZDT) Date: Sat, 5 Feb 2005 08:54:52 +1300 From: Jonathan Chen To: antenneX Message-ID: <20050204195452.GA57738@osiris.chen.org.nz> References: <005c01c50aed$d105c3b0$0200000a@SAGEAME> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <005c01c50aed$d105c3b0$0200000a@SAGEAME> User-Agent: Mutt/1.4.2.1i cc: freebsd-questions@freebsd.org Subject: Re: An AWK question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2005 19:54:55 -0000 On Fri, Feb 04, 2005 at 01:14:57PM -0600, antenneX wrote: > ---> FBSD-4.10p2 > > I have a script that tells me when a mailbox exceeds 2MB. Using it for > another purpose. how can I modify this script to tell me when a file is > LESS than a certain size? > --------------------------------------------- > #!/bin/sh > > #AWK=/usr/bin/awk > #FILE=/file/size/to/check > #LS=/bin/ls > #SIZE=2048 # (2048 = 2MB) > > #if [ `${LS} -s ${FILE} | ${AWK} '{ print $1 }'` -gt ${SIZE} ]; then > # echo File ${FILE} is ABOVE normal | mail -s "Alert: Check the file" > #fi > --------------------------------------------- Just change the word "-gt" to "-lt". -- Jonathan Chen ---------------------------------------------------------------------- "Irrationality is the square root of all evil" - Douglas Hofstadter