UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 4th, 2006, 08:24 AM
treetree treetree is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 4 treetree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 56 sec
Reputation Power: 0
Syntax error displayed when sqlplus is included in a function

Hi,

I am getting a syntax error when I run the command sh -n test.sh for the below script.

Contents of test.sh
-------------------

#!/bin/ksh
function write_to_log
{
MAILCNT=`sqlplus -s user/pwd <<EOT
set feedback off heading off pagesize 0
select count(*) from dual;
EXIT
EOT`

echo $MAILCNT
}
write_to_log

$ >sh -n test.sh
test.sh[8]: 0403-057 Syntax error at line 8 : `<' is not matched.


However, when I remove the function and check for syntax, I don't get any errors.

Contents of test1.sh (with the function commented)
--------------------------------------------------

#!/bin/ksh
#function write_to_log
#{
MAILCNT=`sqlplus -s user/pwd <<EOT
set feedback off heading off pagesize 0
select count(*) from dual;
EXIT
EOT`

echo $MAILCNT
#}
#write_to_log

$ >sh -n test1.sh
$ >


Please help me out and let me know why this is happening... Thanks in advance.

Reply With Quote
  #2  
Old August 4th, 2006, 09:08 AM
treetree treetree is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 4 treetree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 56 sec
Reputation Power: 0
Please note that this is happening only in Korn shell and not in Bourne shell

Reply With Quote
  #3  
Old August 4th, 2006, 09:38 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 762 SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 22 h 8 m 4 sec
Reputation Power: 336
I have not a clue if this would be right at all, but have a look at changing
Code:
EOT`
to
Code:
EOT
`
? That is JUST have the EOT on the line.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Syntax error displayed when sqlplus is included in a function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT