Maciej Cygan Maciej Cygan - 1 year ago 176
Linux Question

unexpected EOF while looking for matching `)'

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

? where as if i extract whats inside the
and put this into a single file and run it it on its own it works just fine as in it sends email as it should.

./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
From: $from
To: $to Subject:
$subject You might want to check this... !) <-- maching haracter for )

echo "$daemail" | /usr/sbin/sendmail -t
<-- line 25

Answer Source

You are using Here document redirection operator(<<) on line 15 that is causing issue. Use following:

         echo "From:" $from
         echo  "To:" $to "Subject:"
         echo  $subject "You might want to check this... !")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download