Skip to content

StrangeRanger/bash-style-guide

Repository files navigation

Bash Style Guide

Project Tracker

Click to access Bash Style Guide

Over the past few years, I've written many Bash scripts—some good, some bad, and some downright ugly. This guide distills those experiences into a comprehensive set of best practices for writing safe, predictable, and maintainable Bash scripts.

Whether you're a beginner looking to avoid common pitfalls or an experienced developer seeking to improve your scripting practices, this guide provides practical advice on error handling, code style, performance considerations, and security practices.

The guide expands significantly upon bahamas10's Bash Style Guide and incorporates foundational principles from Wooledge's Bash Practices. Any practices not explicitly covered here generally align with those resources.

You are encouraged to fork this repository for your own use and contribute to its improvements.

Table of Contents

Local Development

Note

The Bash Style Guide is hosted online at bsg.hthompson.dev. You only need to set up a local environment if you want to preview changes or contribute to the documentation.

Prerequisites

To build and preview the documentation locally, you'll need:

  • Python: Version 3.9 or higher
  • uv: For dependency management

Download and Setup

  1. Clone the repository:

    git clone https://github.com/StrangeRanger/bash-style-guide
    cd bash-style-guide
  2. Install dependencies:

    uv sync
  3. Start the development server:

    uv run mkdocs serve
  4. Open your browser: Visit http://localhost:8000 to view the documentation with live reload.

Support and Community

Have a question, idea, or feedback about the guide?

  • Use Discussions to ask questions, propose new or revised guidelines, request clarifications, or share resources and examples.
  • Use Issues for actionable problems with the docs or site: broken links, incorrect examples, contradictions, build/deploy problems, or tracked maintenance tasks.

Acknowledgments

License

This project is licensed under the MIT License.

About

A style guide for writing safe, predictable, and portable bash scripts (not sh!).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages