Unexpected eof error | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Unexpected eof error

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-10-2008
thana thana is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 7 November 2010, 11:58 PM EST
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old 01-10-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
 
Join Date: Jul 2006
Last Activity: 1 September 2014, 10:49 AM EDT
Location: Berlin, Germany
Posts: 5,392
Thanks: 54
Thanked 229 Times in 222 Posts
insert a "set -xv" in the second line of your script an run it. post the output from screen here...
Sponsored Links
    #3  
Old 01-10-2008
thana thana is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 7 November 2010, 11:58 PM EST
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
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
    #4  
Old 01-10-2008
rein rein is offline
Registered User
 
Join Date: Dec 2004
Last Activity: 31 January 2011, 2:32 PM EST
Location: Zürich
Posts: 151
Thanks: 0
Thanked 1 Time in 1 Post
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.
Sponsored Links
    #5  
Old 01-10-2008
thana thana is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 7 November 2010, 11:58 PM EST
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #6  
Old 01-10-2008
thana thana is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 7 November 2010, 11:58 PM EST
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
the last done statement is as

done < file.txt
Sponsored Links
    #7  
Old 01-11-2008
thana thana is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 7 November 2010, 11:58 PM EST
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
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;
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash script error - syntax error: unexpected end of file smenago Shell Programming and Scripting 6 04-26-2012 08:35 AM
Getting unexpected error NirajThakar Shell Programming and Scripting 5 07-25-2011 10:29 AM
sed error : Syntax error: redirection unexpected phpfreak Shell Programming and Scripting 3 12-04-2008 04:19 AM
unexpected error helpme2008 UNIX for Dummies Questions & Answers 2 05-04-2008 02:08 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM



All times are GMT -4. The time now is 05:05 PM.