Recall & Review
beginner
What is the purpose of comments in a Bash script?
Comments explain what the script or parts of it do. They help others and your future self understand the code easily.
Click to reveal answer
beginner
How do you write a single-line comment in Bash?
Use the # symbol at the start of the line or before the comment text. Everything after # on that line is ignored by the shell.
Click to reveal answer
intermediate
Why should you avoid putting sensitive information in comments?
Comments are visible to anyone who reads the script. Sensitive data like passwords should never be in comments to keep them secure.
Click to reveal answer
beginner
Can comments affect the execution of a Bash script?
No, comments are ignored by the shell and do not affect how the script runs. They are only for humans reading the code.
Click to reveal answer
intermediate
What is a good practice when writing comments in scripts?
Write clear, short comments that explain why something is done, not just what is done. Keep comments up to date with code changes.
Click to reveal answer
Which symbol starts a comment in a Bash script?
✗ Incorrect
In Bash, the # symbol starts a comment. Everything after it on the same line is ignored.
What happens if you put a comment inside a Bash script?
✗ Incorrect
Comments are ignored by the shell and do not affect script execution.
Why is it important to keep comments updated?
✗ Incorrect
Outdated comments can mislead readers, so keeping them updated helps understanding.
Which of these is NOT a good comment practice?
✗ Incorrect
Long paragraphs explaining obvious code can clutter scripts and reduce readability.
Where should you place comments in a Bash script?
✗ Incorrect
Comments should be near the code they describe to help readers understand easily.
Explain how to add comments in a Bash script and why they are useful.
Think about how you would explain your script to a friend.
You got /4 concepts.
Describe best practices for writing comments in scripts.
Focus on clarity and security.
You got /4 concepts.