I have to search 'ORA' word in out.log file,if it is present then i need to send that file (out.log) content to some mail id.If 'ORA' word is not in that file then i need to send 'load succesful' message to some mail id.
The below the shell script is not giving expected result.Please help me to get correct script
if [{cat out.log | grep -c "ORA"} -eq 1]
then
echo out.log
exit 0
else
echo "Load Succes"
fi
grep -c "ORA" outlog 1>/dev/null
if [ $? -eq 0 ] ## some oracle error
then
echo out.log
######## can mail to the user
exit 0
else
echo "Load Succes"
###### can mail to the user
fi
This has the advantage that it will not write any thing on standard out put so no re-direction is required. Also it will exit with success on the first occurance of "ORA", will not search file till the end which is not required.