Unterminated quoted string

Hello!
I wroted a little script that should check for new updates on a server and get them if any. The problem is, every time I run it with sh, I'm getting an "script: 20: Syntax error: Unterminated quoted string" error!
The problem is, there isn't any "unterminated quoted string" in my script:

#!/bin/sh

ip=$(ifconfig tun0 | grep "inet Adresse:10.0.0.[0-9]*" | cut -f 12 -d " " | cut -f 2 -d ":")
logfile="/opt/update/log/$ip_$(date -I).log"
echo "\n-------STARTING-UPDATE--------" > $logfile 2>&1
echo "\n>> $(date)" >> $logfile 2>&1
echo "\n$(scp dude@10.0.0.1:/update/md5.sum /opt/update/md5.sum)" >> $logfile 2>&1
if [ "$(cat /opt/update/old.sum" = "$(cat /opt/update/md5.sum)" ]
then
	echo "\n$(mv /opt/update/md5.sum /opt/update/old.sum)" >> $logfile 2>&1
	echo "\n>> Getting Update-Script..." >> $logfile 2>&1
	echo "\n$(rsync -uv 10.0.0.1/update/update.sh /opt/update/update.sh)" >> $logfile 2>&1
	echo "\n>> Setting autostart" >> $logfile 2>&1
	echo "\n$(cp /opt/update/update.desktop /etc/xdg/autostart/)" >> $logfile 2>&1
	echo "\n------UPDATE-SUCCESSFULL------"
else
	echo "\n>> No new Version" >> $logfile 2>&1
	echo "\n-----------FINISHED-----------" >> $logfile 2>&1
fi
#Line 20:
cat $logfile | ssh dude@10.0.0.1 "cat > /update/log/$ip_$(date -I).log"
exit

I can't find any single " or '
So where is the problem in my script??
Thanks for any help!

(PS: I know the echo "$(command)" >> logfile isn't the best way to solve logging, but it works and thats all I need^^)

You're not missing a quote, but a closing bracket on line 8, with the first cat.

1 Like

Thanks! :b: (especially for the quick answer!)
I would never have found that on my own :wall:
And - yeah! - it works flawless :smiley:
Thread can be closed than! ^^