I am getting the following 2 error outputs when i try to run manually my script below. What i do not understand is why does it complain that it can not find matching character for
')'
then/fi
./rsnapshot-log-checker: line 15: unexpected EOF while looking for matching `)'
./rsnapshot-log-checker: line 25: syntax error: unexpected end of file
grep "ERROR" /var/log/rsnapshot.log | \
while read line ; do
echo "$line" | grep "ERROR"
if [ $? = 0 ]
then
to=warning@bla.com
subject="Error rsnapshot - `hostname`"
from=`hostname`@bla.com
daemail=$(cat <<! <-- line 15
From: $from
To: $to Subject:
$subject You might want to check this... !) <-- maching haracter for )
echo "$daemail" | /usr/sbin/sendmail -t
fi
done
<-- line 25
You are using Here document redirection operator(<<) on line 15 that is causing issue. Use following:
daemail=$(cat
echo "From:" $from
echo "To:" $to "Subject:"
echo $subject "You might want to check this... !")