Vijay Vijay - 1 year ago 101
Bash Question

Commenting out a set of lines in a shell script

I was wondering if there is a way to comment out a set of lines in a shell script.
How could I do that? We can use /* */ in other programming languages.
This is most useful when I am converting/using/modifying another script
and I want to keep the original lines instead of deleting.

It seems a cumbersome job to find and prefix # for all the lines which are not used.

Lets say there are 100 lines in the script in consequent lines which are not to used.
I want to comment them all out in one go. Is that possible?

Answer Source
if false



false always returns false so this will always skip the code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download