Examine Log File To Be Sure O values Are Not Recieved - BASH

bashlinux
#Version 1.0


#DEBUG ON 
#set -x 
tail=$(which tail) 
echo=$(which echo)
logDir=/opt/user/log
binDir=/opt/user/bin
retVal=$?
#break=$(which break)
todaysDate=$(date +"%Y-%m-%d*")
todaysDateNoWc=$(date +"%Y-%m-%d*")
Message=/tmp/Message.txt


lastFile=""
while true 
do
    currentFile=`ls -t ${logDir}/server.${todaysDate}-* | head -1`
    if test "${lastFile}" != "${currentFile}"
    then # the file has been changed
        totalErrorMessages=0
        lastFile="${currentFile}"
    fi
    count=`grep -c -i 'Received values for 0 option(s) from server with 0 invalid values' ${currentFile}`
    if test ${count} -gt ${totalErrorMessages}
    then
        totalErrorMessages=${count}
        $binDir/mailIt.sh 
    fi

    sleep 60
done