Programming · Ebook
Bash: The Ubiquitous Shell and Scripting Language
by Shriira Press
A comprehensive, self-contained guide to Bash (the Bourne-Again Shell) — the most widely deployed shell on Earth and the de-facto standard for shell scripting. Bash runs almost everywhere: it's the default on most Linux distributions, the backbone of CI pipelines, Docker images, and server automation, and the language of countless .sh scripts that hold the software world together. This book teaches Bash as it's actually used — both as an interactive shell and, above all, as a scripting language for robust automation — covering variables and quoting, expansions, word splitting and globbing, arrays, conditionals, loops, functions and scripts, I/O and process management, and the production essentials: writing robust scripts (set -euo pipefail, traps), portability (POSIX sh vs bashisms), and ShellCheck. It blends intuition (what the shell is doing and why), concepts (the rules — especially the ones that bite), and runnable code (real bash you can paste and adapt).
Contents
- 1Preface
- 2Chapter 1 — What Is Bash?
- 3Chapter 2 — Getting Started: The Command Line and Bash Basics
- 4Chapter 3 — Variables, Parameters, and Quoting
- 5Chapter 4 — Expansions: Brace, Tilde, Parameter, Command, Arithmetic, Glob
- 6Chapter 5 — Word Splitting, Globbing, and the Perils of Unquoted Variables
- 7Chapter 6 — Arrays and Associative Arrays
- 8Chapter 7 — Conditionals and Tests
- 9Chapter 8 — Control Flow: Loops and case
- 10Chapter 9 — Functions, Scripts, and Arguments
- 11Chapter 10 — I/O, Redirection, Pipes, and Process Management
- 12Chapter 11 — Writing Robust Scripts
- 13Chapter 12 — Portability, Debugging, and ShellCheck
- 14Chapter 13 — Bash in Practice and the Profession
- 15Appendix A — Glossary and Quick Reference
- 16Appendix B — Further Reading and Resources
