I have a utility that produces a report which includes the below section:
Code:
recommended_actions
---------------------
(0 rows)
I want to set a variable for this section:
Code:
ALERT=`sed -e '/recommended_actions/,/(0 rows)/!d' ${LOGFILE}`
echo $ALERT
recommended_actions --------------------- (0 rows)
I then want to send an email if $ALERT equals something else, ie:
Code:
recommended_actions
---------------------
Replace Disk!
(1 row)
Code:
if [[ ${ALERT} != "recommended_actions --------------------- (0 rows)" ]] ; then
mail -s "ALERT: ${HOSTNAME} disk monitor" ${DBA} < ${LOGFILE}
fi
With this set up, I receive an email regardless of what $ALERT equals. How can I set this to only send me an email if there's something beneath the "recommended actions" line?
Thanks.