Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 07 · DevOps · CI/CD, IaC & Operations · about 19 min to read

Play it as a journeyTutor comes with a plan

Scripts that do not surprise: bash, text tools and cron

The Assembly Line
The Assembly Line · Open board

The assembly line where each step hands its result to the next. A shell script is a small line like this, and this lesson is about making each step stop the line when it fails, instead of passing a broken part along.

Lesson 48 of 70 in DevOps

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • A cleanup script runs in the wrong folder
  • Exit status: the number every command leaves behind
  • Safe mode: three switches that stop the script at the first mistake
  • Pipefail: a pipe is only as honest as its last step
  • grep, sed and awk: three tools that cut a log down to an answer
  • xargs: turn lines into arguments, and run them side by side
  • Idempotent: the script you can run twice
  • Cron: the clock that runs your script, and the lock that stops two at once
  • What each switch does, and where -e stops working
  • A script that checks its own inputs
  • Quoting: why "$dir" has quotes
  • Atomic writes, so no reader sees half a file
  • awk, sed and grep: the choices that decide which tool
  • xargs: more than one way to hold a batch
  • Cron, in detail
  • Where cron stops being enough

Terms it explains: exit status, safe mode, `grep`, `sed`, `awk`, `xargs`, idempotent, Cron, lock, Common mistakes, CI.

Review DevOps