Unterminated quoted string

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unterminated quoted string
# 1  
Unterminated quoted string

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:

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@ /opt/update/md5.sum)" >> $logfile 2>&1
if [ "$(cat /opt/update/old.sum" = "$(cat /opt/update/md5.sum)" ]
	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 /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------"
	echo "\n>> No new Version" >> $logfile 2>&1
	echo "\n-----------FINISHED-----------" >> $logfile 2>&1
#Line 20:
cat $logfile | ssh dude@ "cat > /update/log/$ip_$(date -I).log"

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^^)
# 2  
You're not missing a quote, but a closing bracket on line 8, with the first cat.
This User Gave Thanks to pludi For This Post:
# 3  
Originally Posted by pludi
You're not missing a quote, but a closing bracket on line 8, with the first cat.
Thanks! Smilie (especially for the quick answer!)
I would never have found that on my own Smilie
And - yeah! - it works flawless Smilie
Thread can be closed than! ^^
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #504
Difficulty: Medium
Typically, programs operate in a reverse-linear flow of control.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Unterminated <> operator

Hello. I'm self teaching myself and coded a program but I keep getting a illegal division by 0 error. I know what it means but I don't know where I am messing up. Here is the code: #!/usr/bin/perl @lines = <>; my %earned; my %possible; for ($i = 1; $i <... (6 Replies)
Discussion started by: Eric7giants
6 Replies

2. Shell Programming and Scripting

awk string comparison unterminated quoted string andrule of thumb

I have the logic below to look up for matches within the columns between the two files with awk. In the if statement is where the string comparison is attempted with == The issue seems to be with the operands, as 1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies

3. Shell Programming and Scripting

Unterminated Regular Expression

It is ok when I send send one arguement to $TILL in the awk expression. first(){ TILL=$1 echo $TILL awk '/:\\/ {P=0} P {print $0 "<br>"} FNR==1{printf("File %s:<br>", FILENAME)} /'$TILL'\/ {P=1} ' ${dirlist } } echo "<table border = '1'>" echo '<tr><td> </td><td>' ;... (3 Replies)
Discussion started by: alvinoo
3 Replies

4. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies

5. UNIX for Dummies Questions & Answers

Getting " Unterminated quoted string"

Hi Guys, When I am executing the script #! /bin/bash SARBACKUPS=/home/pradeep/sarBackups cd /var/log/sysstat ls -1t sar* | while read SARNAME do cp -p "$SARNAME" $( echo "$SARBACKUPS"/"$HOSTNAME"_"$SARNAME"_"`date +"%Y%m%d`.bkup ) done I am getting final.sh: 1: Syntax... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

6. Shell Programming and Scripting

Deleting double quoted string from a line when line number is variable

I need to remove double quoted strings from specific lines in a file. The specific line numbers are a variable. For example, line 5 of the file contains A B C "string" I want to remove "string". The following sed command works: sed '5 s/\"*\"//' $file If there are multiple... (2 Replies)
Discussion started by: rennatsb
2 Replies

7. Shell Programming and Scripting

Take quoted output from one script as quoted input for another script

Hi, I have a script output.sh which produces the following output (as an example): "abc def" "ghi jkl" This output should be handled from script input.sh as input and the quotes should be treated as variable delimiters but not as regular characters. input.sh (processing positional... (2 Replies)
Discussion started by: stresing
2 Replies

8. Shell Programming and Scripting

Syntax error: Unterminated quoted string

I keep having problems when exicuting this file. It always gives me the error message "36: Syntax error: Unterminated quoted string" If someone could help me edit this it would be much appreciated. #!/bin/sh # # This will continue adding numbers # untill the total is greater than 1,000 #... (5 Replies)
Discussion started by: evilSerph
5 Replies

9. Shell Programming and Scripting

how to delete blanks inside a quoted string

Hi I need to update a string inside a file which looks like the following: PX_LIST=" 4119 2390 2294 2776 2897 4099 " Is there a way to get rid of the blanks after the first quote mark and before the last quote mark. This needs to be done ONLY for the string named PX_LIST (there are some... (4 Replies)
Discussion started by: aoussenko
4 Replies

10. UNIX for Dummies Questions & Answers

Unterminated string

While running a shell script i am getting this warning but the script is working fine.while running the blocks of the scripts individually its running fine.But while pasting it combinedly this is the warning..wat may be the reason behind this and how to resolve it (3 Replies)
Discussion started by: dr46014
3 Replies

Featured Tech Videos