Hi
pls help me with this if clause , which is marked in red .
It gives me an error saying :-
: integer expression expected
and it goes to the else part and writes output the WARNING STATEMENTS ..
the values of if [ "$rcInPAudit" = "$rcInP" ]; then
rcInPAudit and rcInP match each other exactly ..but it does not go the if part and gives an error (saying integer expression expected )
The script runs good till the above mentioned if clause ,
and also it prints out :-
Number of Records in ProGV file = 34
Number of Rows Copied into PROGV = 34
proGVshell.sh: [: 34
: integer expression expected
Pls help ..
thanks ..rxg
#************************************************************************#
#*************** CHECKING THE BCP STATUS ********************************#
# this writes the output from the bcp in into the OUTPUT.out file #
#************************************************************************#
echo
echo '*** NEXT LINES ARE OUTPUT FROM BCP IN PROGV TABLE***'
cat bcpinprovmsg.out
echo
# this checks for bcp in failure message
bcpinprov=`grep -i "bcp copy in failed" bcpinprovmsg.out`
if [ "$bcpinprov" = "" ]; then
echo "BCP COPY IN PROGV SUCCEEDED"
# this routine returns the number of rows in GV
# and assigns it to rcInP variable
rowsInProv=`grep -h "Number of rows in PROGV" $RUNDIR/OUTPUT.out`
count=1
for i in $rowsInProv
do
if [ $count -eq 6 ]; then
rcInP=$i
fi
count=`expr $count + 1`
done
rowsInProvAudit=0
rowsInProvAudit=`grep -h "Number of records written for PROGV
bcp:" $MMISDIR/Provider_Audit.log`
echo $rowsInProvAudit
countP=1
for i in $rowsInProvAudit
do
if [ $countP -eq 8 ]; then
rcInPAudit=$i
fi
countP=`expr $countP + 1`
done
echo "Number of Records in ProGV file = " $rcInPAudit
echo "Number of Rows Copied into PROGV= " $rcInP
if [ "$rcInPAudit" = "$rcInP" ]; then
echo 'correct number of rows were loaded into PROVIDER'
else
echo '*** WARNING *** WARNING *** WARNING *** WARNING ***'
echo ' Discrepancy between number of records in PROGV.txt '
echo ' and number of rows loaded into PROGV. Check bcp'
echo ' load statistics and ProvLoadInErr.out file.'
echo
if [ -r ProvLoadInErr.out ]; then
echo '*** REJECTED ROWS FROM BCP OF PROGV.txt ***'
cat ProvLoadInErr.out
fi
SUBJECT=""$runat"-ProGV_Processing_OfRows:Error"
mailx -s $SUBJECT $MAILTOPROG < $RUNDIR/OUTPUT.out
exit
fi
else
SUBJECT=""$runat"-ProGV_Processing_OfRows:Error"
mailx -s $SUBJECT $MAILTOPROG < $RUNDIR/OUTPUT.out
exit
fi