Code commenting Problems in shell scripting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Code commenting Problems in shell scripting
# 1  
Old 03-25-2012
Code commenting Problems in shell scripting

Hi Friends,
I Want to comment one line of code from below code.


Code:
DBA_ORACLE_USER=`DB.sh -u -a User`
DBA_ORACLE_PWORD=`DB.sh -p -a User`

sqlplus /nolog <<-END > ${logfile} 2>&1

WHENEVER OSERROR  EXIT 9
WHENEVER SQLERROR EXIT SQL.SQLCODE
connect ${DBA_ORACLE_USER}/${DBA_ORACLE_PWORD}@${ORACLE_SID}
@${GITD_RootDir}/ABC/abc.sql
exit;
END

==================

I have commented as shown below.



Code:
DBA_ORACLE_USER=`DB.sh -u -a User`
DBA_ORACLE_PWORD=`DB.sh -p -a User`
#Commented  start By Sri
#sqlplus /nolog <<-END > ${logfile} 2>&1
#Comment end by Sri
sqlplus /nolog <<-END >> ${logfile} 2>&1
WHENEVER OSERROR  EXIT 9
WHENEVER SQLERROR EXIT SQL.SQLCODE
connect ${DBA_ORACLE_USER}/${DBA_ORACLE_PWORD}@${ORACLE_SID}
@${GITD_RootDir}/ABC/abc.sql
exit;
END

Script is working fine. But it's logging below error in log file.

Code:
SP2-0734 : unknown command begning " Added by...." rest of lines ignored

.

I thought , this problem might be unix comments inside oracle code.
Pls suggest on this.

Thanks in advance.
please use code tags

Last edited by methyl; 03-25-2012 at 05:36 PM..
# 2  
Old 03-25-2012
Quote:
" Added by...."
The string does not appear in the code posted. Is it in abc.sql or more likely DB.sh ?
# 3  
Old 03-26-2012
Hi Methyl,
This is inside shell script , the name of the script is GenRep.sh.
Inside this script iam calling abc.sql file.So, here my intention is , to escape from the logging error in log file.Here script is working fine and it's generating report also.
And i tried with below option also.

Code:
--commented start by Sri
--sqlplus /nolog <<-END > ${logfile} 2>&1
sqlplus /nolog <<-END >> ${logfile} 2>&1
--commented end by Sri

Thanks in advance.

Last edited by methyl; 03-26-2012 at 01:53 PM.. Reason: please use code tags
# 4  
Old 03-26-2012
Code:
Comment lines in unix Shell script start with a hash character.
# comment
mycommand myparameters      # comment

Code:
Comment lines in Oracle SQL start with any of an assortment of alternatives:

-- comment

REM comment

/* comment */

/*
     lines of 
     comment
*/


The Oracle error SP2-0734 : unknown command begning usually means that you have a comment line without any of the special comment markers.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

100 interesting shell scripting problems

Hi all, I'm just learning to write shell scripts (new to the whole UNIX thing) and I'm wondering if anyone would like to help me create a resource to help me, and others like me, learn scripting. It would be something like "100 interesting shell scripting problems". All I need are... (7 Replies)
Discussion started by: nickednamed
7 Replies

2. Shell Programming and Scripting

Commenting out a cron entry through a shell script

In my cron thare is a line like 24 11 * * * /usr/batch/bin/abc.sh > /usr/batch/log/abc.log 2>&1 along with other entries. I want to comment out this line through a shell script. My local variable 'line'ontains the full entry (i.e. 24 11 * * * /usr/batch/bin/abc.sh > /usr/batch/log/abc.log... (4 Replies)
Discussion started by: Soham
4 Replies

3. Shell Programming and Scripting

Commenting Multiple lines using Shell Script

I have an xml file which has following code : <abc-ref> <abc-name>abc.efg.hij.klm</abc-name> </abc-ref> I want to comment this whole section out and I have written the following script : (where "hij" is unique string in the file) TEMPFILE=replaceYY.tmp file=hello.xml sed -n... (6 Replies)
Discussion started by: Dish
6 Replies

4. Programming

shell scripting problems involving operations with remote machine

Hi, i have been developing a shell script to transfer a set of files from one ubuntu system to another. Task: while executing the script the files ( ls, dir, cat) in the source machine should transfer to destination machine(at /home/mac/mac/bin) While the script is executed once again, It... (0 Replies)
Discussion started by: srijith
0 Replies

5. Shell Programming and Scripting

Commenting lines in Shell script

Hi All, I know we can comment by using "#" .... I want to know... is there any way to comment a whole big script easily.... In a file i need to comment more than 15 lines ........ and check the script and un comment back. I am learning VI now so its taking lot of time to comment and un... (4 Replies)
Discussion started by: firestar
4 Replies

6. Shell Programming and Scripting

Shell scripting problems - Commands not on local machine

Hello all- I have done a lot of searching tonight, but all leads seem to be dead ends. Forgive me if this has been covered, but I've searched the forum and the internet. I am having trouble building a shell script which uses SSH to login to our schools 1024 cluster grid. The issue that I am... (1 Reply)
Discussion started by: Sagan
1 Replies

7. Shell Programming and Scripting

Shell code problems

So I have a line that is suppose to find all files in a folder and then run a program through all the files and then output the files with a _.txt ending. find ./ -name '*' -exec sh -c 'intersect-by-ids -ff {} -fc 1 -if normed_occ.txt -ic 1 \> {}_.txt'\; the error that i get is "find: missing... (2 Replies)
Discussion started by: kylle345
2 Replies

8. Shell Programming and Scripting

shell scripting on unix/mysql problems

Hi, I have written a shell script for oracle on unix that does a df for specific files, and then will display the size, Avail, % used and the difference from yesterday to today. I have been asked to place it on some MySql databases that run onn unix and linux also, but when I try to run them I... (2 Replies)
Discussion started by: cat55
2 Replies

9. Shell Programming and Scripting

How to execute the rest of the code after commenting multiple lines?

Hi, As I have seen in this forum how to comment multiple lines in the script, but it does not work properly for me. It is blocking the code but it does not execute the rest of the codes. This is my code #! /usr/bin/ksh month='date +"m%"' : << Comments Block if || then echo "inc =... (12 Replies)
Discussion started by: Yamini Thoppen
12 Replies
Login or Register to Ask a Question