The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with csh script rahulrathod Shell Programming and Scripting 4 02-21-2008 12:38 PM
script problem tdavenpo Shell Programming and Scripting 3 01-04-2006 04:07 PM
Problem starting a script from a 'main'-script Rakker UNIX for Dummies Questions & Answers 3 06-28-2005 09:12 AM
problem with a script Lestat Shell Programming and Scripting 4 06-13-2005 01:30 PM
problem with ftp script...please help vancouver_joe UNIX for Advanced & Expert Users 2 11-22-2001 07:47 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-23-2006
PradeepRed PradeepRed is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 25
Ksh problem in script

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

Last edited by PradeepRed; 08-23-2006 at 09:03 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0