Skip to content
Shell & Terminal

Shell Scripting and Terminal Fundamentals, in Order

Where shells came from and how bash/zsh/sh actually differ, then the mechanics — subshells, expansion, quoting, job control, signals — that most scripting bugs trace back to, ending in writing scripts that actually port.

9 posts, in order

  1. 1HistoryThe History of the Unix Shell: From Thompson Shell to Bash and ZshEvery shell in daily use today descends from a 1971 command interpreter, branching through PWB, Bourne, and C shell into the families still visible now.
  2. 2Deep DiveBash vs. Zsh vs. sh: What Actually Differs Between POSIX ShellsBash, Zsh, and sh accept most of the same commands, which is exactly what makes their real differences easy to miss until a script breaks.
  3. 3Deep DiveEnvironment Variables, Exports, and Subshell BoundariesShell variables and the process environment overlap but differ. Export, fork/exec, subshells, pipelines, sourcing, and Shellshock define where changes survive.
  4. 4Deep DiveHow Shell Expansion and Globbing Actually WorkBash rewrites typed commands through an ordered sequence of expansions before running them. The exact order explains most quoting and globbing surprises.
  5. 5Deep DiveShell Scripting Pitfalls: Quoting, Word Splitting, and Why $var Isn't Always SafeAn unquoted variable works in testing, then silently breaks the first time its value contains a space — the single most common shell scripting bug.
  6. 6Deep DiveJob Control: How Shells Manage Foreground and Background ProcessesCtrl-Z, bg, fg, and a trailing & all touch one mechanism: process groups and Unix signals deciding which process can read your terminal.
  7. 7Deep DiveShell Signal Handling: trap, Cleanup, and Process GroupsReliable shell cleanup requires understanding signals, traps, process groups, and the important difference between a normal exit and an uncatchable termination.
  8. 8How-ToHow to Write Robust, Portable POSIX Shell ScriptsWriting shell scripts that run correctly under any POSIX-compliant shell, not just whichever one happens to be installed on your own machine.
  9. 9FixFixing 'Command Not Found' Right After Installing SomethingA tool you just installed is definitely on disk, but the shell insists it doesn't exist — almost always a PATH problem, with only a few actual explanations.