The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unexpected error helpme2008 UNIX for Dummies Questions & Answers 2 05-04-2008 11:08 AM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 08:16 AM
tar:read error: unexpected EOF mikeruth UNIX for Advanced & Expert Users 4 01-18-2008 02:30 PM
tar: write error: unexpected EOF jabe UNIX for Dummies Questions & Answers 4 12-05-2007 04:40 PM
tar: write error: unexpected EOF vijayakumar.pc Shell Programming and Scripting 7 04-19-2007 08:41 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-10-2008
Registered User
 

Join Date: Jan 2008
Posts: 52
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
sqlplus -s training1/training1 << EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done > file.txt

IFS=$O;


Can anyone help me
Reply With Quote
Forum Sponsor
  #2  
Old 01-10-2008
DukeNuke2's Avatar
Soulman
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 1,487
insert a "set -xv" in the second line of your script an run it. post the output from screen here...
Reply With Quote
  #3  
Old 01-10-2008
Registered User
 

Join Date: Jan 2008
Posts: 52
This is the output I got


-bash-3.00$ ./prog.sh
O=$IFS; IFS=",";
+ O='
'
+ IFS=,

while read a b c d
do
echo $c
sqlplus -s training1/training1 << EOF
./prog.sh: line 19: syntax error: unexpected end of file
Reply With Quote
  #4  
Old 01-10-2008
Registered User
 

Join Date: Dec 2004
Location: Zürich
Posts: 146
I've noticed there's a space between << and EOF. Try removing it:

Code:
#!/bin/bash
O=$IFS; IFS=",";
while read a b c d
do
echo $c
sqlplus -s training1/training1 <<EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done > file.txt

IFS=$O;
See if that helps.
Reply With Quote
  #5  
Old 01-10-2008
Registered User
 

Join Date: Jan 2008
Posts: 52
I have tried but still its comming.
But the following code works

#!/bin/sh
sqlplus -s training1/training1 << EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('File Open Error');

END;
/
EOF
Reply With Quote
  #6  
Old 01-10-2008
Registered User
 

Join Date: Jan 2008
Posts: 52
the last done statement is as

done < file.txt
Reply With Quote
  #7  
Old 01-10-2008
Registered User
 

Join Date: Jan 2008
Posts: 52
Ohhh I got it finally..but still count not locate the error in the first code....
Can anyone point it out..

#!/bin/bash
O=$IFS; IFS=",";
while read a b c d
do
echo $c
sqlplus -s training1/training1 <<EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done < a
IFS=$O;
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0