I have a section of a script where I want to check a log file for a certain oracle error and if there is only one error (and it is ORA-39152) then I want to email that script is complete. Otherwise email failure and log.
Somehow with this while the log only has one error and it is ORA-39152, I keep getting the failure message. Can someone look over and maybe see my foolish mistake?
counterrors=$(egrep 'ORA-' ${MLOG5} | wc -l)
if [egrep 'ORA-39152:' ${MLOG5}] && [$counterrors = 1];
then
uuencode $MLOG $MLOG1 $MLOG2 $MLOG3 $MLOG4 $MLOG5 | mail -s "PLR ARCHIVING SUCCESSFULLY COMPLETED ${datestamp}" xxxxxxxx
exit
else
((ERRORS=ERRORS+1))
mail -s "PLR ARCHIVING ERRORS IN PRICEARCH IMPORT LOG " xxxxxx < $MLOG5
exit $ERRORS
fi