typestar

Language basics

26 steps in 9 sets of Bash.

Bash is the language everyone uses and almost nobody studies. It runs your CI, your deploys, your dotfiles and the glue between every tool you own, and it is old enough that its sharp edges are load-bearing: quoting decides whether a filename with a space survives, an exit code decides whether a pipeline lies to you, and the difference between $@ and $* has broken real deployments. Studying it for a few hours repays a decade of copy-pasted incantations.

This tour covers the shell as a language: expansion and quoting, the test and case constructs, loops over words and lines, real arrays, functions, and the pipes and redirections that compose small tools into big answers. grep, sed and awk get a set of their own, and the safety set teaches the prelude every serious script starts with. Every seed parses under bash -n and passes shellcheck before it reaches you.

Start this tour

Variables & quoting

Conditionals

  • if & [[ ]]Branching on comparisons, globs and the filesystem.
  • caseOne value against many patterns, first match wins.
  • Exit codesZero is success, everything else is failure, and && || route on it.

Loops

  • for loopsThree shapes: a word list, a C-style counter, a generated sequence.
  • while readThe line-by-line loop that processes streams.
  • Brace expansionThe shell generates strings before anything runs.

Arrays

Functions

Pipes & redirection

Text tools

  • grepSearch, count and invert with extended regexes.
  • sedThe stream editor: substitute, delete, select.
  • awkColumn math on whitespace-split records.

Scripts & safety

Encore

The other Bash tours