An AWK question

Jonathan Chen jonc at chen.org.nz
Fri Feb 4 11:54:55 PST 2005


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 <jonc at chen.org.nz>
----------------------------------------------------------------------
                        "Irrationality is the square root of all evil"
                                                  - Douglas Hofstadter


More information about the freebsd-questions mailing list