Block Comment in Shell script


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Block Comment in Shell script

how to put multiline comments in a shell script like /* Some code */ in C language?
# 2  
Quote:
Originally Posted by skyineyes
how to put multiline comments in a shell script like /* Some code */ in C language?
There is no multiline comment in Shell script
# 3  
Quote:
Originally Posted by skyineyes
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  
Quote:
Originally Posted by radoulov
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

Smilie
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Shell Script Comment code blocks in a bash source file
HiFuture0801
Just began to learn on Shell Script. I got an exercise from my friend. I know how to make this happen in C, but I'm not familiar with Shell Script. Hope I can get some help from all of you. I want to write a bash script to comment code blocks in a bash source file. What I mean comment is '#', I...... Shell Programming and Scripting
1
Shell Programming and Scripting
Easiest way to comment/uncomment a shell script?
saggiboy10
cd path line1 line2 line3 line4 line5 Lets say thats the sample script...So say if i have to comment the above script, which would be the better way so that whenever i want, i cud comment or uncomment the same. Thanks... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers
multiline comment in shell script
hiten.r.chauhan
Is thery any way to give comment to multiple line without explicitly specifying # at the begining of each line ?... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
Script to put block comment after finding regex in xml file
Poki
hi, i need my bash script to find regex in xml file.. and comment 2 lines before and after the line that contains regex.. can't use # needs to be <!-- at the beginning and --> and the end of the comment. so eg.. first block <filter> <filter-name>MyRegEx</filter-name> ...... Shell Programming and Scripting
11
Shell Programming and Scripting
comment and uncomment a line with Shell Script
anthonyraj75
Requirement is: 1. comment and uncomment the line with Shell Script: /opt/admin/fastpg/bin/fastpg.exe -c -=NET (using fastpg.exe as a search option) 2. display = "Commented" (when its commented) and display = "Uncommented" (when its uncommented) Its urgent, please let me asap!!! Thanks in...... Shell Programming and Scripting
2
Shell Programming and Scripting