memory full warning message

Hi I wrote a script


#!/usr/bin/ksh
#set -x
for fs in `df -k|awk '{print $1}'|sed -n "3,14 p"`
do
    x=`df -kl | grep $fs | awk '{ print $5 }'`
        y=50%

            if [ $x -gt $y ]
                then
                      message="File System `df -k |grep $fs |awk '{print $6\", \"$5}'` Full!!!"
                            echo $subject
                                  echo $message | mailx -s "`hostname` - File System Full Warning !!!"  $RECEIVER
                                      fi
                                      done


here i am not getting the value of x to compare with y because of this the error is coming. how to fix this.

ocuut1@france>./memoryfull_warning
+ ./memoryfull_warning
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: unknown test operator
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: bad number
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: unknown test operator
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected

You commented out your 'set -x'. If you left it, you could have seen what happened. Do that and see if you understand what's happening. BTW, an easier Ksh-safe example of what you're trying to do could be

thresh=20; df|awk '/\/dev\/[sh]d/ {print $1, $5}'|while read part perc; do
 [ ${perc//\%/} -ge $thresh ] && echo $part $perc over $thresh
done

Also please use "better" thread titles as "memory full warning message" is not what yours is about, it's just scripting errors.