Leanpub Header

Skip to main content

Zero to Hero Bash

Build a Real Backup Tool, One Commit at a Time

This book is 100% completeLast updated on 2026-07-20

Learn Bash the way it should be taught: by building one real, tested backup tool — not toy examples — one Git commit at a time.

Minimum price

$19.99

$29.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

Zero to Hero Bash teaches you Bash the way you'd actually learn it on the job: by building one real program, one deliberate step at a time.

Over 10 chapters and 8 milestones, you'll build backup_docs.sh — a script that finds documents on a Windows file share and copies them safely to an external drive — while surviving everything that goes wrong in the real world: dead networks, unplugged drives, typo'd config files, and file names with spaces.

Every chapter follows one rule: no line of code without a story of the failure it prevents. Instead of "this is best practice, just do it," you'll see the actual bug each safeguard exists to stop, then build the fix yourself.

By the end, you'll have:

- A working, ShellCheck-clean, test-covered backup tool you built yourself, line by line

- A Git history that mirrors a real 28-commit teaching repository, so you can compare your work commit-by-commit against a working answer key

- The habit of writing scripts that stop when something is wrong, instead of silently continuing

The book covers strict-mode fundamentals, logging, config file loading, CLI argument parsing with getopts, preflight connectivity checks, the array-as-command pattern for building shell-safe rsync commands, error traps, and a full Bats test suite — plus five appendices (glossary, header cheat sheet, ShellCheck reference, commit map, and notes for teachers running this as a course).

A companion GitHub repository with the finished, working code is included, so you can check your progress against real commits at every step.

Author

About the Author

Muhammad Y. Rasheed

Muhammad Y. Rasheed is a systems administrator working in Linux system administration, virtualization, and network infrastructure, with a long-running homelab practice spanning Proxmox, Docker, and VPN/tunneling setups, ..etc. He was born and raised in Iraq — ancient Mesopotamia, the cradle of civilization, where writing and the first codified laws began — and traces a direct line from that tradition to his own work: turning operational knowledge earned the hard way into something written down, tested, and repeatable. Zero to Hero Bash began as backup_docs.sh, a production backup tool he built for his own infrastructure, with a Git history designed from the start to double as a teaching path. He treats "boring" infrastructure work — backups, logging, error handling — as the most important code in any system.

Contents

Table of Contents

Copyright and License

Why This Book Exists (A Word From the Trenches)

About this book

Chapter 0 — Your Workshop

Chapter 1 — A Script That Can’t Lie

  1. Milestone 1: entry point + strict mode

Chapter 2 — Teaching the Script to Talk

  1. Milestone 2: logging module

Chapter 3 — Settings Live Outside the Code

  1. Milestone 3: config loading

Chapter 4 — Listening to the User

  1. Milestone 4: argument parsing with getopts

Chapter 5 — Look Before You Leap

  1. Milestone 5: the preflight gate (SMB connectivity checks)

Chapter 6 — The Actual Backup

  1. Milestone 6: disk-space check + rsync core

Chapter 7 — When Things Break Anyway

  1. Milestone 7: ERR and EXIT traps

Chapter 8 — Prove It Works

  1. Milestone 8: tests with bats-core

Chapter 9 — Graduation

  1. One Step From the Full Picture

Chapter 10 — From Classroom to Production

  1. Bonus chapter: the finished project, and the first real backup run

Appendix A

  1. Glossary (student words)

Appendix B

  1. The header, memorized

Appendix C

  1. ShellCheck codes met in this course

Appendix D

  1. The answer-key commit map

Appendix E

  1. Notes for teachers and study groups

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub