drive space shell script help ?

Charles Howse chowse at charter.net
Mon Sep 15 11:18:20 PDT 2003


> #!/bin/sh
> # this is a script to check drive space and email HSD dept.
> #
> cd ~bbailey
> rm ~bbailey/drvspc.txt
> df -k  | awk '{print$5}' >~bbailey/drvspc.txt
> cat drvspc.txt
> while read i
> do
>         if [$i > '89'];  then

This line should be:
	if [ $i -gt 89 ] ; then

The spaces between the leading and trailing brackets are mandatory, and
you had 2 spaces between the ; and 'then', and the comparison operator
for integers is '-gt' for 'greater than'.  I don't believe you need the
ticks around 89 either.

A great source for help: http://www.tldp.org/LDP/abs/html/




More information about the freebsd-questions mailing list