Comment

noun

say it: “KOM-ent” /ˈkɑmɛnt/

A note written in a script for people to read, which the shell skips when it runs the script.

What is a comment in a bash script?

A comment is a note for the people who read a script. Bash skips everything from a # at the start of a word to the end of the line, so a comment can say what the script is for, or why a line is there.

# morning.sh: my start-of-the-day check.
echo "Good morning, $USER!"   # greets whoever is signed in

In a sentence

  • “The first comment in morning.sh says what the script is for.”
  • “Sam added a comment after the df line to remind himself why it was there.”

Level: Novice · More Unix terms at this level

Updated

In other subjects