![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| sed script help urgent | jaganadh | Shell Programming and Scripting | 5 | 06-29-2007 02:50 AM |
| [urgent need help] about script | bucci | Shell Programming and Scripting | 6 | 12-26-2006 01:21 AM |
| Script - Urgent Help | troy86 | Shell Programming and Scripting | 4 | 06-01-2006 06:33 AM |
| Need a Script(Urgent) | udayben | Shell Programming and Scripting | 7 | 06-06-2005 10:45 AM |
| Urgent !!! - Script to Change passwords in unix | tofani | SUN Solaris | 2 | 09-16-2003 07:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
[urgent need help] unix script....
hi experts,
i'm new in scripting unix i have some problem with my script below is shown my script : #!/bin/sh BASEDIR=/export/home/mapadm BINDIR=$BASEDIR/bin LOGDIR=$BASEDIR/log TDRDIR=$LOGDIR/TDR BACKUPDIR=/data/log export BASEDIR BINDIR LOGDIR TDRDIR BACKUPDIR YEAR=`date '+%Y'` MONTH=`date '+%m'` DAY=`date '+%d'` HOUR=`date '+%H'` if [ $HOUR -eq 00 ] ; then HOUR=23 LASTDAY=`/export/home/mapadm/bin/lastdate 1 | nawk '{print $1}'` filename="$LASTDAY$HOUR.TDR" else cd $TDRDIR/200701 HOUR=`expr $HOUR - 1` HOUR=`printf "%02d" $HOUR` filename="$YEAR$MONTH$DAY$HOUR.TDR" #grep "$YEAR$MONTH$DAY $HOUR" $BINDIR/TDR.LOG > $TDRDIR/$filename #count = `nawk '$12 == "00008001" { cnt++;cs_cd[$11] } END { print "Count:"cnt;for(cd in cs_cd) print cd }' $filename` count=`nawk '$12 == "00008001" { cnt++;cs_cd[$11] } END { print cnt }' $filename` if [$count -gt 1 ] ; then countsend=`nawk '$12 == "00008001" { cnt++;cs_cd[$11] } END {for(cd in cs_cd) print cd }' $filename` cd $BINDIR msggen msggen_SMClient.txt 1 "[1234567890]" "[$countsend not bind]" fi fi the script name is "countsms.sh" i try to run script but having some error like below : %countsms.sh countsms.sh: test: argument expected please advices Regards, bucci |
|
||||
|
Code:
if [ $count -gt 1 ] ; then The error might occur in this line if the count variable does not contain any value. To avoid the error you can use double square brackets Code:
if [[ $count -gt 1 ]] ; then |
|
||||
|
hi anbu,
not working Quote:
|
|
||||
|
Quote:
below is the result: BASEDIR=/export/home/mapadm BINDIR=/export/home/mapadm/bin LOGDIR=/export/home/mapadm/log TDRDIR=/export/home/mapadm/log/TDR BACKUPDIR=/data/log + export BASEDIR BINDIR LOGDIR TDRDIR BACKUPDIR + date +%Y YEAR=2007 + date +%m MONTH=01 + date +%d DAY=31 + date +%H HOUR=18 + [ 18 -eq 00 ] + cd /export/home/mapadm/log/TDR/200701 + expr 18 - 1 HOUR=17 + printf %02d 17 HOUR=17 filename=2007013117.TDR + nawk $12 == "00008001" { cnt++;cs_cd[$11] } END { print cnt } 2007013117.TDR count= + [ -gt 1 ] countsms.sh: test: argument expected any idea? thank you for your attention Regards, bucci |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|