PrintableCharts

THE CONDITIONS OF TRAP

FIVE conditions from the standard — EXIT and four signals — and three extensions a conformant shell refuses

Built as a memo rather than a table: the thing worth hanging it up for reads across the room, with the full reference in smaller type below it.

Three sizes in one archive — from a sheet on the fridge to a poster on the wall.

Free

By downloading you agree to the Terms.

Formats
A4 · A3 · A2
What you get
Print-ready PDFs, one per size, with every letterform converted to outlines — nothing to install, nothing to shift.
Subject
code · everyone · memo · study

Above, eight words trap will accept, five from the standard and three found only in some shells. Below, the same eight tested on this machine's dash and bash, and two consequences of what an EXIT trap sees.

INSIDE AN EXIT TRAP, $? IS STILL WHAT IT WAS BEFORE

A variable is assigned twice after the trap on EXIT is already set — and the trap sees the last value, because the standard says: “The environment in which the shell executes a trap action on EXIT shall be identical to the environment immediately after the last command executed before the trap action on EXIT was executed.”.

Inside the trap you can run a command that changes $? — and the script's own final exit status still stays what it was before the trap: “The value of "$?" after the trap action completes shall be the value it had before the trap action was executed.”.

On the sheet

  • Above, eight words trap will accept, five from the standard and three found only in some shells. Below, the same eight tested on this machine's dash and bash, and two consequences of what an EXIT trap sees.
  • Colour carries meaning, but meaning never rests on colour alone — the sheet reads in black and white.
  • Nothing about how it was made: the sheet carries only what the reader needs.

Printing

  • Three sizes in the archive: A4 — 210×297 mm, A3 — 297×420 mm, A2 — 420×594 mm.
  • All text is converted to outlines. No fonts to install, and nothing shifts on another machine.
  • White background and sparing fills — it prints on a home printer without draining the cartridge.
  • Margins of at least 10 mm: a home printer cannot print to the edge.
  • No stroke thinner than 0.3 mm, so nothing disappears in print.

Why the numbers can be trusted. Every countable number here is computed from data rather than typed in, and the sheet must pass 8 independent checks before it is allowed to build — how many items there are, the order they come in, and the claim in the highlighted box itself. If one fails, there is no file.

More like this