Comment out multiple lines with csh

When you want to comment out multiple lines at once

<<Comment out statement

Comment out statement

Surround with.

There was no problem with sh and bash, but I got an error in csh. Here's what worked.

Hello_1.csh


#!/bin/csh

echo "Takato    : Hello, Nadeshiko!"
echo "Nadeshiko : Hello Takato."

:<< 'COMMENT_OUT'

echo "Takato    : Hello Riichiro, too."
echo "Riichiro  : ... Hello"

'COMMENT_OUT'

Execution result

Takato : Hello, Nadeshiko! Nadeshiko : Hello Takato.


An example of commenting out that I often see in articles but did not work

Hello_2.csh


#!/bin/csh

echo "Takato    : Hello, Nadeshiko!"
echo "Nadeshiko : Hello Takato."

<< COMMENT_OUT

echo "Takato    : Hello Riichiro, too."
echo "Riichiro  : ... Hello"

COMMENT_OUT

Execution result

Takato : Hello, Nadeshiko! Nadeshiko : Hello Takato. Invalid null command.


** Conclusion **

:<< 'Comment out statement'

'Comment out statement'

The following seems to be the point.

** 1. Put ": (colon)" at the beginning of the sentence ** ** 2. Enclose the commented out string in single quotes **
It worked fine with sh and bash.

The conversation is from my favorite game, CLOCK ZERO. Riichiro who takes an unfriendly attitude toward Takato, a transfer student who calls out to his childhood friend Nadeshiko, is cute.

Recommended Posts

Comment out multiple lines with csh
Comment out
Tips for plotting multiple lines with pandas
python comment out
Multiple selections with Jupyter
Multiple regression analysis with Keras
# 2 [python3] Separation and comment out
Manipulate multiple proxies with Squid
[Python3] Dijkstra's algorithm with 14 lines
Animate multiple graphs with matplotlib
Control multiple robots with jupyter-lab
Implement blockchain with about 60 lines