Solved

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

Posted on 2004-08-18
11
2,156 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
11 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now