Help to resolve unexpected EOF while looking for matching `"' error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help to resolve unexpected EOF while looking for matching `"' error
# 1  
Old 08-17-2012
Help to resolve unexpected EOF while looking for matching `"' error

Hi,
can someone kindly look into my copy script and figure out why am i getting a "unexpected EOF while looking for matching `"' error message
Code:
#!/bin/ksh -x
 
 
cd /home/goldenga/test/flag37
 
if [ -f "copied.ok" ]; then
rm copied.ok
cd /home/goldenga/test
Upper=`ls -t|grep 'qw*'|cut -d "w" -f 2|head -2|tail -1`
lower=`ssh goldenga@10.132.109.37 ls -t /home/goldenga/test|grep 'qw*'|cut -d "w" -f 2|head -1`
fst=$Upper
lst=$lower
fst=`expr $fst + 0`
lst=`expr $lst + 0`
    if [ "$fst" -eq "$lst" ]; then
       echo "No Files To Copy"
 
    else if [ "$lst -lt "$fst" ]; then 
            a=$lst
            while [[ $a -le $fst ]]; do 
  
                  a=`echo $a |awk '{ printf "%06d\n", $0 }'`
                  fil="qw"$a
                  echo $fil
                  a=`expr $a + 1`
                  scp -rp $fil 10.132.109.37:/home/goldenga/test
   
            done
 
         else
            a=$lst
            while [[ $a -ge $fst ]]; do 
 
                  a=`echo $a |awk '{ printf "%06d\n", $0 }'`
                  fil="qw"$a
                  echo $fil
                  a=`expr $a + 1`
                  scp -rp $fil 10.132.109.37:/home/goldenga/test 
 
                   if [ $a -eq 999999 ];
                      then a=0
                   fi
            done
         fi
     fi
cd /home/goldenga/test/flag37
touch copied.ok
 
#else 
#echo $a 
fi


Last edited by Franklin52; 08-17-2012 at 06:26 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 08-17-2012
Here it is:
Code:
else if [ "$lst" -lt "$fst" ]; then

# 3  
Old 08-17-2012
Quote:
Originally Posted by NDalal007
Hi,
can someone kindly look into my copy script and figure out why am i getting a "unexpected EOF while looking for matching `"' error message


#!/bin/ksh -x


cd /home/goldenga/test/flag37

if [ -f "copied.ok" ]; then
rm copied.ok
cd /home/goldenga/test
Upper=`ls -t|grep 'qw*'|cut -d "w" -f 2|head -2|tail -1`
lower=`ssh goldenga@10.132.109.37 ls -t /home/goldenga/test|grep 'qw*'|cut -d "w" -f 2|head -1`
fst=$Upper
lst=$lower
fst=`expr $fst + 0`
lst=`expr $lst + 0`
if [ "$fst" -eq "$lst" ]; then
echo "No Files To Copy"

else if [ "$lst" -lt "$fst" ]; then
a=$lst
while [[ $a -le $fst ]]; do

a=`echo $a |awk '{ printf "%06d\n", $0 }'`
fil="qw"$a
echo $fil
a=`expr $a + 1`
scp -rp $fil 10.132.109.37:/home/goldenga/test

done

else
a=$lst
while [[ $a -ge $fst ]]; do

a=`echo $a |awk '{ printf "%06d\n", $0 }'`
fil="qw"$a
echo $fil
a=`expr $a + 1`
scp -rp $fil 10.132.109.37:/home/goldenga/test

if [ $a -eq 999999 ];
then a=0
fi
done
fi
fi
cd /home/goldenga/test/flag37
touch copied.ok

#else
#echo $a
fi
# 4  
Old 08-17-2012
Wow what a find
Thank You Hergp that works....
# 5  
Old 08-17-2012
Just for the record:
* a good syntax highlighting editor would reveal the error right away, when quoted strings are colored differently.
* Shell should give you syntax error on this. You can use -n switch to check for syntax errors without running.
* Please use code tags when posting code or i/o.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Sh: -c: line 0: syntax error near unexpected token `(' how to resolve this

Below query is not working for me. Please help me on this DATA EXCLUDE STATEMENT: TABLE:\"LIKE \'%\_HISTORY\'\", TABLE:\"LIKE \'%\_HIST\'\", TABLE:\"in \(select tname from tab where REGEXP_LIKE(TNAME,\'\_H$\'\))\", TABLE:\"LIKE \'%\_LOG\'\", TABLE:\"LIKE \'DW\_%\'\", TABLE:\"LIKE... (1 Reply)
Discussion started by: princy
1 Replies

2. SCO

"Unexpected EOF within #IF, #ifdef or #ifndef" error when rebuilding / relinking SCO OpenServer 5

Hi, I am a new Unix Guru with very little experience but have the task of P2Ving an old HP Proliant ML370 G5 server to VMware ESX 4.1 or ESXi 5.5. System seems to boots fine but when trying to remove HP software, configure TCP/IP or a driver, I am receiving: -------- ... (7 Replies)
Discussion started by: dj_Italian
7 Replies

3. Shell Programming and Scripting

In awk: unexpected EOF while looking for matching `"'

I am trying to get grep with awk command into variable. But facing error. Could someone pls help. $ cat test_file DEPLOYMENT="abc" # com cluster="bcn" $ grep DEPLOYMENT test_file | awk -F "\"" '{ print $2 }' abc $ a=`echo "grep DEPLOYMENT test_file | awk -F \"\\\"\" '{ print $2 }'"` ;... (6 Replies)
Discussion started by: Manasa Pradeep
6 Replies

4. Shell Programming and Scripting

Unexpected EOF while looking for matching `'' when ran from a cron job

Since cPanel does not support deleting emails older then X amount of days I am using the following on a Cron Job. find -P /home/user/mail/domain/ -mindepth 2 -mtime '+366' -type f -printf '"%p"\n' | grep -v '/Important' | grep -v '/.Important' | xargs -I {} rm -r "{}" Executing it via SSH... (4 Replies)
Discussion started by: tiagom
4 Replies

5. Shell Programming and Scripting

Unexpected EOF while loooking for matching '"

Hi everyone, I'm really new in shell scripting and having trouble resolving this error. Can someone please tell me why I'm getting these errors? Error Message: ./test.sh: line 50: unexpected EOF while looking for matching `'' ./test.sh: line 53: syntax error: unexpected end of file ... (4 Replies)
Discussion started by: simonirang
4 Replies

6. Shell Programming and Scripting

Unexpected EOF while looking for matching `"'

I have a piece of Linux script. It tells me some syntax error. I couldn't find it. Please help me to identify them. Thanks. The code looks like this: export ORACLE_SID=MYDB export SPW=`cat /opt/oracle/scripts/.sys_pw_$ORACLE_SID` export check_arch=`sqlplus -s << EOF / as sysdba... (7 Replies)
Discussion started by: duke0001
7 Replies

7. Shell Programming and Scripting

line 85: unexpected EOF while looking for matching `"'

hello everyone...im having this problem with unexpected EOF with line 85 which is..i cant see whats wrong with it..can any1 plz help me out. read -p "$p1 please enter the number of tries you wish to have:" lifeline function main() { guessnum=0 read -p "Please... (6 Replies)
Discussion started by: Freakhan
6 Replies

8. Shell Programming and Scripting

Unexpected EOF while looking for matching `"'

Hi everyone, I am trying to search for a string in a file that is partly made up of a variable. Here's the code: echo "parentCategory = $parentCategory" echo "parentCategoryFormatted = $parentCategoryFormatted" numUrlsFoundInParentCategory=`grep -c "<Topic r:id=\"Top\/World\/Français\/"... (2 Replies)
Discussion started by: BlueberryPickle
2 Replies

9. Shell Programming and Scripting

"unexpected end of file" when I´m use EOF inside block if

I have a trouble in my script when i use EOF inside block if. If i use EOF whitout block if I don´t have problem. Guys any ideas? Sorry for my terrible English. #!/bin/sh set -xv HOST='ftp.fiction.com.br' USER='fictionuser' PASS='fictionpass' FILE='ftpteste.txt' busca=`find... (4 Replies)
Discussion started by: ricardo.ludwig
4 Replies

10. Shell Programming and Scripting

Unexpected eof error

Hi, I am newbie and am just trying to connect to oracle from shell script ,,,but I am getting the following error ./prog.sh: line 20: syntax error: unexpected end of file The scripts is : #!/bin/bash O=$IFS; IFS=","; while read a b c d do echo $c ... (6 Replies)
Discussion started by: thana
6 Replies
Login or Register to Ask a Question