Solved

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

Posted on 2004-08-18
11
2,170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

718 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