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
./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 ]
subject="Error rsnapshot - `hostname`"
daemail=$(cat <<! <-- line 15
To: $to Subject:
$subject You might want to check this... !) <-- maching haracter for )
echo "$daemail" | /usr/sbin/sendmail -t
<-- 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... !")