help with simple korn scripting

Hi,

The logic is very simple but I can't seem to make this work in Korn shell.
I need to check two files to make sure there is no errors. Each of the file will have number. For example, first file btt.txt will have 112 which is good. Second file bgg.txt will have 6 which is also good. If I see any other numbers other than 112 and 6 than we have a issue.

#!/usr/bin/ksh
LOGFILE=/tmp/btt.txt
LOGFILE2=/tmp/bgg.txt
cat $LOGFILE
if [ $LOGFILE -eq 112 ]
then echo "No Errors found"
else
echo "Error found"
fi
cat $LOGFILE2
if [ $LOGFILE2 -eq 6]
then echo "No errors found"
else
echo "Error found"
fi

Please advise. Thanks.

Hope this helps:

#!/bin/ksh

LOGFILE1="/tmp/btt.txt"
LOGFILE2="/tmp/bgg.txt"

if [ `cat $LOGFILE1` -eq 112 ]
then
echo "No Errors Found In $LOGFILE1"
else
echo "Error Found In $LOGFILE1"
fi

if [ `cat $LOGFILE2` -eq 6 ]
then
echo "No Errors Found In $LOGFILE2"
else
echo "Error Found In $LOGFILE2"
fi

exit 0

Thank you so much, it's working now. I need to learn so much, I worked on this for hours and I could not get it correct. You are able to solve it in minutes. :slight_smile:

No problem. Just keep at it, it'll come.

Please put code inside

 tags.


#!/usr/bin/ksh
LOGFILE=/tmp/btt.txt
LOGFILE2=/tmp/bgg.txt
cat $LOGFILE
if [ $LOGFILE -eq 112 ]

[/quote]

[indent]
All cat does is display the contents of the file. If you want to use the contents, read it into a variable:

read lf1 < "$LOGFILE"
if [ "$lf1" -eq 112 ]