Skip to main content
Clear, concise comments make your shell scripts easier to maintain, understand, and extend. Follow these best practices to ensure your scripts are well-documented and self-explanatory.

Header Comment Structure

A standardized header typically includes:
With modern version control systems like Git, embedding a change history in comments is usually redundant.

Example Header

Tips for Effective Comments

  • Keep lines under 80 characters for readability.
  • Write comments in complete sentences where clarity is needed.
  • Update comments whenever you modify related code blocks.
  • Avoid over-commenting trivial code—focus on intent, not implementation.

References

Watch Video