?
Solved

syntax error at line 149: `end of file' unexpected

Posted on 2004-08-18
11
Medium Priority
?
2,177 Views
Last Modified: 2008-02-01
Hi ,

I am cought up in a strange error . I am getting  syntax error at line 149: `end of file' unexpected
when I try to run a script.
Strange thing is the line it says is not present in the file . I am going crazy from past 2 days .
any 1 please give some suggetions.



here is the code . I came to know that these , the line with $ISQL is giving prob. If i comment out thaat line then syntax error is going off .


            $ISQL << _ENDQ | egrep -v -e "^      NodeName |^ ---"> $STARTCSRIPT
            $DB_PASSWD
            use $REF_DB
            go
            set nocount on
            go

            select * from table
            go

            _ENDQ


Thanks
Raghava
0
Comment
Question by:raghava_dg
  • 5
  • 3
9 Comments
 

Author Comment

by:raghava_dg
ID: 11836137
Thanks ..... , Never mind on this qtn guyz.
I found the answer.

Solution :

never ever leave a space while u connecting to ISQL . i,e start from the first column of the line ,don't  use space or tab in the begining of the line.


Thanks
Raghava
0
 
LVL 20

Expert Comment

by:Gns
ID: 11840037
It's actually the "here document" that is giving you grief... The ENDQ label needs come smack first on the line. So what you were seeing was a "runaway here document".

-- Glenn (not expecting points for this, just thought you'd like to know;-)
0
 
LVL 20

Expert Comment

by:Gns
ID: 11840059
Just to demonstrate:
# cat << ENDQ
>   aklöaslö
>  ENDQ
> ENDQ
  aklöaslö
 ENDQ
#
See?

-- Glenn
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:raghava_dg
ID: 11849113
Thanks Glen ,

But what do you mean by " here document " ? I did not understand.  Can you send me any link where can I get little knowledge abt this ?

Thanks
Raghava
0
 

Author Comment

by:raghava_dg
ID: 11849132
I will  not give points to any one .

Moderator ...Please let me know how to close this qtn without granting the points .
0
 
LVL 20

Expert Comment

by:Gns
ID: 11850932
HERE DOCUMENT is the name of the construct by which you "redirect" text from the start label unto the endlable _from the same "file" as the shell is reading the script. As I demonstrate this can be used with any command to which you can redirect input ... In the example it is the "cat" command.
As you can see in the example (you can try it at the shell prompt! An interactive shell reads its commands from the "stdin" file;-) Both the line "  aklöaslö" and the line " ENDQ" is interpreted as being part of the input... the shell only sees the "ENDQ" line as the "ending label".
Since "here documents" are part of the shell, they are documented in the shells manpage. So do read the manpage for your shell (be it sh, ksh, bash, zsh, csh, tcsh ....:-). If you don't know how to use the man command, the pages are available at several places on the net... I like the ones you can find on http://www.tldp.org ;-)

You can contact Community Support to have them handle this if Achim fails to see it... Just place a 0 point question (with a link back here) in that TA.
... We're slowly working away from 0-points here, don't you think:-).

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 12082222
Well... Perhaps never really took off from "0-point quality":-).
My only reason for commenting was to adjust the reasoning as to why the fix discovered by the questioner worked, so I've got no real, nor imaginary, objections:-):-)

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 12101467
... And there we see how much points merit in my choice regarding commenting or not:-). I hadn't even looked at that.
You've of course got the right of it jmcg.

-- Glenn
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12117774
PAQed - no points refunded (of 20)

Computer101
E-E Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question