Hi
I made a small script which uses ksh.
Quote:
#!/usr/bin/ksh
USSD_PATH=/usr/Nokia/USSD/log
LOGFILE=$USSD_PATH/ussd_nokia.log
DATE_STAMP=`date +%d%m%Y`
HOUR=`date +%H`
DAY=`date +%d`
FILE=$USSD_PATH/ussdlog$DATE_STAMP
if [ $HOUR -eq 0 ];then
PREV_HOUR=23
else
PREV_HOUR=`expr $HOUR - 1`
fi
if [ $HOUR -eq 1 ];then
echo "Date|Hour|Total Attempts|Total Successful|Total Errors|Time Out Errors|WNP Connect Errors|Other Errors" > $FILE
fi
grep "|$DAY-" $LOGFILE| grep "|$PREV_HOUR:" > $USSD_PATH/temp1
restart_time=`grep "success connecting to NRH server" $USSD_PATH/temp1 | cut -d"|" -f3`
if [ -z "$restart_time" ];then
echo "USSD Restarted at $restart_time" >> $FILE
fi
ENTRIES=`wc -l $USSD_PATH/temp1|awk '{print $1}'`
SUCCESS=`grep " TEMPORARY FIX" $USSD_PATH/temp1 | wc -l`
TIMEOUT=`grep "no response from NRH" $USSD_PATH/temp1 | wc -l`
WNP=`grep "detected WNP layer error" $USSD_PATH/temp1 | wc -l`
OTHER=$((ENTRIES-(SUCCESS+TIMEOUT+(WNP*3))))
TOTAL=$((SUCCESS + $TIMEOUT + WNP + OTHER))
ERRORS=$((TIMEOUT + WNP + OTHER))
echo "$DAY|$PREV_HOUR|$TOTAL|$SUCCESS|$ERROR|$TIMEOUT|$WNP|$OTHER" >> $FILE
|
When i run the script then i get the following error
Quote:
|
stats.sh: syntax error at line 34: `OTHER=$' unexpected
|
However when i run each of the commands on the commandline they get executed and provide the desired output. i cant figure out why the script is not running.
Kindly Help
Thanks in advance