Block Comment in Shell script | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Block Comment in Shell script

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-02-2007
skyineyes skyineyes is offline
Registered User
 
Join Date: Jun 2007
Last Activity: 24 July 2014, 1:23 AM EDT
Posts: 194
Thanks: 3
Thanked 1 Time in 1 Post
Block Comment in Shell script

how to put multiline comments in a shell script like /* Some code */ in C language?
Sponsored Links
    #2  
Old 07-02-2007
anbu23's Avatar
anbu23 anbu23 is offline Forum Advisor  
Advisor
 
Join Date: Mar 2006
Last Activity: 31 July 2014, 8:46 AM EDT
Location: Bangalore,India
Posts: 2,089
Thanks: 12
Thanked 131 Times in 126 Posts
Quote:
Originally Posted by skyineyes View Post
how to put multiline comments in a shell script like /* Some code */ in C language?
There is no multiline comment in Shell script
Sponsored Links
    #3  
Old 07-02-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 1 September 2014, 10:03 AM EDT
Location: Варна, България / Milano, Italia
Posts: 5,667
Thanks: 182
Thanked 617 Times in 575 Posts
Quote:
Originally Posted by skyineyes View Post
how to put multiline comments in a shell script like /* Some code */ in C language?

Code:
: '
comments here
and here
'

If your comments contain single quotes:


Code:
: <<'END'
comments' here
and here
END

    #4  
Old 07-02-2007
vino's Avatar
vino vino is offline Forum Advisor  
Supporter (in vino veritas)
 
Join Date: Feb 2005
Last Activity: 9 April 2013, 8:19 AM EDT
Location: Sydney, Down Under
Posts: 2,847
Thanks: 0
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by radoulov View Post
Code:
: '
comments here
and here
'

If your comments contain single quotes:


Code:
: <<'END'
comments' here
and here
END

Just make sure that the string END does not appear among the commented lines. Or chose a marker which is not so easily repeated.


Code:
:<<supercalifragilisticexpialidocious
echo "This will not get printed"
echo "Yet another escape"
supercalifragilisticexpialidocious

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
multiline comment in shell script hiten.r.chauhan UNIX for Dummies Questions & Answers 2 03-31-2011 03:51 AM
Script to put block comment after finding regex in xml file Poki Shell Programming and Scripting 11 01-14-2011 02:57 PM
comment and uncomment a line with Shell Script anthonyraj75 Shell Programming and Scripting 2 07-30-2009 07:03 AM
Pulling data from a standard comment block - perl khuilman Shell Programming and Scripting 1 03-24-2009 01:05 PM
block editing, collapse, comment. max_475 UNIX for Advanced & Expert Users 2 12-05-2008 01:29 PM



All times are GMT -4. The time now is 09:52 PM.