Comments unexpectedly print


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Comments unexpectedly print
# 1  
Old 04-10-2007
Comments unexpectedly print

Hi All,

I am working on a sh script.
Half way through the script, my comments start to print to screen as if I used echo.
Obviously any comments are preceded with a #.
And I have not used set -x or anything similar.

Can anyone free me of this simple but annoying problem?

Thanks

John
# 2  
Old 04-11-2007
Hi,
If u can post the part of the code where comment is getting printed,then i can take a look into it.
Thanks
Raghuram
# 3  
Old 04-11-2007
Quote:
Originally Posted by John H
Hi All,

I am working on a sh script.
Half way through the script, my comments start to print to screen as if I used echo.
Obviously any comments are preceded with a #.
And I have not used set -x or anything similar.

Can anyone free me of this simple but annoying problem?

My crystal ball is fuzzy, but I think it's saying you are missing one or more quotes (probably on line 42).

Post your code and someone can check it for you.


# 4  
Old 04-11-2007
Hmmmm I guess a few clues would have been helpful.
Via a process of elimination, I tracked the problem to the following line:
echo "\"$location $plant $desig $quantity\ " $rid"
After this statement all comments where echoed to the screen and echo didnt work.
For example echo $func would not show the content of func
Once I commented the line out - problem gone - so I presume there is something in the syntax of that one particular line that caused the problem.
# 5  
Old 04-11-2007
Quote:
Originally Posted by John H
Hmmmm I guess a few clues would have been helpful.
Via a process of elimination, I tracked the problem to the following line:
echo "\"$location $plant $desig $quantity\ " $rid"
After this statement all comments where echoed to the screen and echo didnt work.
For example echo $func would not show the content of func
Once I commented the line out - problem gone - so I presume there is something in the syntax of that one particular line that caused the problem.

There's a space after the second backslash, so that the quote is not escaped. It should (presumably) be:

Code:
echo "\"$location $plant $desig $quantity\" $rid"


Last edited by cfajohnson; 04-11-2007 at 08:51 PM.. Reason: Typo
# 6  
Old 04-11-2007
Thanks for thatSmilie - without the space it works perfectly.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

System got restarted unexpectedly

One of our Host server got restarted unexpectedly and all we got is this. Not able to guess the root cause behind this .Please help. Before restart Oct 17 19:56:06 SERVER1 kernel: suspend: event channel 75 Oct 17 19:56:10 SERVER1 smartd: smartd version 5.38 Copyright (C) 2002-8 Bruce... (3 Replies)
Discussion started by: pinga123
3 Replies

2. Red Hat

Server rebooting unexpectedly

hi, I have been working on Solaris am very new to linux. My concern is as it goes....our server is getting rebooted automatically and I am not able to understand anything from the var log messages. Could anybody help me out in troubleshooting the issue. 2.6.18-128.el5 #1 x86_64 GNU/Linux is... (1 Reply)
Discussion started by: EmbedUX
1 Replies

3. UNIX for Dummies Questions & Answers

Machine shutdown unexpectedly

Hi One of our Linux box got shutdown unexpectedly . I have noticed that 4 out of 8 nic ports were not blinking . I m not sure where to search logs . Any help would be appreciated. Please find the var/log/message Is it a case of power failure as nothing specific is getting logged(Just a... (7 Replies)
Discussion started by: pinga123
7 Replies

4. Shell Programming and Scripting

print only comments

I want to write a shell script which it takes as argument a java file or a c++ file (.java or .cpp). It will check if the file is type of java or c++, else it ends with error message. If all are ok, it will call awk that prints only the comments that the java or c++ file contains, grouping and... (5 Replies)
Discussion started by: Mark_orig
5 Replies

5. Shell Programming and Scripting

Sed script, changing all C-comments to C++-comments

I must write a script to change all C++ like comments: // this is a comment to this one /* this is a comment */ How to do it by sed? With file: #include <cstdio> using namespace std; //one // two int main() { printf("Example"); // three }//four the result should be: (2 Replies)
Discussion started by: black_hawk
2 Replies

6. Shell Programming and Scripting

tr command behaving unexpectedly

Im trying to execute the below command on our server to list files and replace the newline in the file list with spaces, but the character 'n' is getting replaced with a space, is there any environment variable that needs to be set in UNIX? sh -c 'ls -trx... (1 Reply)
Discussion started by: rameshrr3
1 Replies

7. Shell Programming and Scripting

Gawk combining lines unexpectedly

I am attempting to combine sections of log that should be one line but are spaced out over 10-30 lines due to how the software is outputting the info. (If I am making a newbie mistake I apologize) Example of log I am working with: 2009-04-14 14:51:22 access data here info. Info. Info. ……..... (4 Replies)
Discussion started by: demanche
4 Replies

8. Shell Programming and Scripting

script unexpectedly terminating

I now that this isnt the greatest code around. Im a network guy by trade not a programer .. but needed something to compare config files ... Anyway ... intermittently, the program terminates. Ive been looking at the code for a week trying to figure it out and Im stumped. Can anyone provide... (0 Replies)
Discussion started by: popeye
0 Replies

9. UNIX for Dummies Questions & Answers

Print comments in FTP

Dear Unix Gurus, Not sure if this is possible/workable but I'm trying add a comment line before each operation such as the following: ftp -n <mail server> ${log_dir}/test_put.log << END user <user_id> <password> verbose bin # List Files Before putting Data echo File Check Before FTP >>... (7 Replies)
Discussion started by: lweegp
7 Replies
Login or Register to Ask a Question