• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

k shell syntax error..

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
mahjag
Asked:
mahjag
  • 5
  • 5
1 Solution
 
omarfaridCommented:
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
 
mahjagAuthor Commented:
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
 
omarfaridCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
mahjagAuthor Commented:
using vi editor in unix
0
 
omarfaridCommented:
is it working now?
0
 
mahjagAuthor Commented:
and I checked there is no space after the last line
0
 
omarfaridCommented:
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
 
mahjagAuthor Commented:
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
 
mahjagAuthor Commented:
OK it is working now, I took all the extra spaces and made it as 1 line instead of separate lines..
0
 
omarfaridCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now