LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-17-2005, 10:45 AM   #1
Prasun1
Member
 
Registered: Jun 2005
Posts: 41

Rep: Reputation: 15
here document `EOF' unclosed


Hi all,

I have the following piece of code in one of my shell script.


........
if [ $choice -eq 1 ]
then
no_of_constraints=`sqlplus -s $OracleId 2>/dev/null <<EOF
set heading off;
set verify off;
set feedback off;
select count(*) from user_constraints where table_name='$table_name';
exit;
EOF`
......

I have ended the if loop properly after this.

Now when I am running this shell script I am getting the following error:
here document `EOF' unclosed

It will be really useful if anyone can suggest probable cause for this error.


Thanks and Regards
Prasun
 
Old 09-17-2005, 10:56 AM   #2
teebones
Member
 
Registered: Aug 2005
Location: /home/teebones
Distribution: sometimes this, sometimes that..
Posts: 502

Rep: Reputation: 56
i noticed the ` after EOF, hope this is a typo...
 
Old 09-17-2005, 11:06 AM   #3
Prasun1
Member
 
Registered: Jun 2005
Posts: 41

Original Poster
Rep: Reputation: 15
No it's not a typo , basically ` is also there just before sqlplus(no_of_constraints=`sqlplus)

So ` after EOF ends the ORACLE session.

Thanks
 
Old 09-17-2005, 11:23 AM   #4
teebones
Member
 
Registered: Aug 2005
Location: /home/teebones
Distribution: sometimes this, sometimes that..
Posts: 502

Rep: Reputation: 56
missed that ;-)
 
Old 09-18-2005, 01:14 AM   #5
Prasun1
Member
 
Registered: Jun 2005
Posts: 41

Original Poster
Rep: Reputation: 15
Yeah it's ok .............but it will be really nice if anyone can provide me the real cause of the problem

Thanks
Prasun
 
Old 09-18-2005, 06:50 AM   #6
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
The real cause of the problem is, as teebones has pointed out, the ` at the end of EOF. The ` should be at the end of the command - the hereis document ends with a line containing EXACTLY AND ONLY the content of the initial tag. Add that ` and it breaks, as you've found. That line should look like
Code:
no_of_constraints=`sqlplus -s $OracleId 2>/dev/null` <<EOF
I find it easier to echo the command in, personally.
 
Old 06-26-2007, 12:28 AM   #7
doug.sinclair
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 0
here doucument 'EOF' unclosed

I have just come across this error in a shell file.
#!/bin/ksh
sqlplus apps/apps << EOF
select * from dual;
exit;
EOF

Eventually I found out that the second EOF had a space after the EOF which when removed fixed the problem
 
Old 06-27-2007, 04:14 AM   #8
Jeiku
Member
 
Registered: Jul 2005
Posts: 64

Rep: Reputation: 18
Any lines precede << VAR need to be terminated by VAR on a line by itself. So the backtick (`) was the problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
here document `EOF' unclosed Prasun1 Linux - General 2 09-18-2005 07:11 AM
EOF finding Goblin_C_Noob Programming 7 09-10-2005 09:58 AM
how do i create a document, then a directory and save the document in it. jtdodge Linux - Newbie 9 06-15-2005 11:03 AM
Convert openoffice document into ms document through cli? bruno buys Linux - Software 0 07-05-2004 09:59 AM
<< Eof ? sikandar Linux - Software 5 09-18-2003 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration