grep -i "BUILD FAILED" /opt/bea/wls61/config/dev05/batch_automation/MBPSBatch/databaselog/claim_extract.log
rcode=$? ############save the return code here if Failed found it would be 0
if [ $rcode -ne 0 ]
then
echo "No failed found run the script abc.sh"
. /ags/hsf/trf/jkyt/abc.sh
else
echo "Failed encounter ..."
mail -s "what ever "
whatever@whatever.com
fi
------
this code should work !
you can't compare the Z with BUILD fail as the grep command doesn't return the searc pattern it return the entire line .
So always save the return code of the command and compare it with 0
Here : if the grep command found "build fail " in the search file then rcode most be zero
you can test the rcode and accordingly take the action
Cheer!
have try .