Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Block Comment in Shell script

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-02-2007
skyineyes skyineyes is offline
Registered User
 
Join Date: Jun 2007
Last Activity: 17 October 2014, 2:06 AM EDT
Posts: 197
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 Unix and Linux 07-02-2007
anbu23's Unix or Linux Image
anbu23 anbu23 is offline Forum Advisor  
Advisor
 
Join Date: Mar 2006
Last Activity: 16 March 2015, 4:56 AM EDT
Location: Bangalore,India
Posts: 2,136
Thanks: 14
Thanked 150 Times in 143 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 Unix and Linux 07-02-2007
radoulov's Unix or Linux Image
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 April 2015, 3:05 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 624 Times in 582 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 Unix and Linux 07-02-2007
vino's Unix or Linux Image
vino vino is offline Forum Advisor  
Supporter (in vino veritas)
 
Join Date: Feb 2005
Last Activity: 12 March 2015, 5:33 AM EDT
Location: Sydney, Down Under
Posts: 2,848
Thanks: 0
Thanked 13 Times in 13 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

Linux
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 05:34 PM.