Solved

k shell syntax error..

Posted on 2009-04-07
10
517 Views
Last Modified: 2013-12-27
Hi

I have the following code in k shell that errors..
#!/bin/ksh
 sqlplus -s /nolog <<EOF > $MYFOLDER/logs/spool_file.log
  set serveroutput on
  start $HOME/connect_oracle
  execute mypack.procedure($SOURCE,$OUTPUT)
  exit
  EOF

and I have the error
myshell[2]: syntax error at line 2 : `<<' unmatched

I tried to get /cut space before EOF or after EOF and still does not work.. could not figure out what is wrong.. I am running in solaris box..
0
Comment
Question by:mahjag
  • 5
  • 5
10 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 24090791
Do you have space before the closing END ? From what you posted I could see that you have. remove it or use

sqlplus -s /nolog <<-EOF > $MYFOLDER/logs/spool_file.log


0
 

Author Comment

by:mahjag
ID: 24091037
I tried to not have space after EOF and still the same syntax error

I tried sqlplus -s /nolog <<-EOF > $MYFOLDER/logs/spool_file.log
and still same syntax error..
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24091141
if you notice I said before the closing END (at the last line)
how you edit the script file? are you transferring it from  windows?
0
 

Author Comment

by:mahjag
ID: 24091160
using vi editor in unix
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24091203
is it working now?
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:mahjag
ID: 24091204
and I checked there is no space after the last line
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24091232
I say a gain , before END not after it. you may cut and paste from below

#!/bin/ksh
sqlplus -s /nolog <<EOF > $MYFOLDER/logs/spool_file.log
set serveroutput on
start $HOME/connect_oracle
execute mypack.procedure($SOURCE,$OUTPUT)
exit
EOF
0
 

Author Comment

by:mahjag
ID: 24091274
what do you mean by END? the last line EOF? I checked no space anywhere from first line to last line - am I missing something?
0
 

Author Comment

by:mahjag
ID: 24091378
OK it is working now, I took all the extra spaces and made it as 1 line instead of separate lines..
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 125 total points
ID: 24091397
sorry I meant EOF. The code you posted in your question has leading space in the last line before EOF. There should not be any space
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

Suggested Solutions

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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.
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.

911 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

24 Experts available now in Live!

Get 1:1 Help Now