Skip to content

Shell

Shell constructions—bash and zsh mechanics worth a permanent URL.
Choose a tag. Hold Command or Control to combine tags.

Recovery Paths

 4 min Arranging a way back before taking the next step, from shell cleanup to snapshots and atomic publication.

Aug 28, 2026

The Send Button

 4 min An empty-delimiter heredoc from an old trick list became the send step of a multi-agent shell protocol.

Aug 26, 2025

Email-Keyed Git Identity

 2 min Selecting a preferred SSH key from Git’s effective email address, with organization-specific identity set by the remote URL.

Jun 28, 2025

The last extra argument

 3 min In letter.sh’s extended merge form, Bash array slicing moves the last extra argument into pdfcpu’s destination slot.

Mar 4, 2025

printf %n

 2 min C’s notorious write-through format directive lives on in bash, where one format string yields output and measured byte offsets.

Jun 22, 2024

The stateful generator

 2 min A bash parameter expansion whose array subscript advances every time it expands.

Jun 22, 2024

Pushing terminfo over ssh’s stdin

 2 min Fixing ‘unknown terminal type’ by streaming terminfo through ssh’s stdin and compiling it remotely, with no separate copy step.

Apr 9, 2019

td

 2 min A tmux session keyed by a raw directory path, with extra commands smuggled through a trailing semicolon.

Oct 31, 2018

atexit for bash

 3 min A LIFO exit-handler stack from jira-nice, with a nonstandard signal map and a broken pop-by-count path.

Jun 4, 2018

The repo is the .jira.d

 2 min jira-nice makes its own checkout the go-jira config directory with one symlink, and inherits a parent repo’s Jira defaults with one extra glob path.

Jun 4, 2018

shutils.jq

 3 min Turning jira-nice’s JSON options into Bash declarations, with a saved JSON copy and some sharp limits on what can cross the boundary.

Jun 4, 2018

Escaped spaces in tmux’s terminfo

 1 min Twelve escaped spaces interrupted tmux’s SGR capability; removing them restored the intended terminal control sequence.

May 16, 2018

Truecolor escapes in diff-so-fancy

 1 min Bold plus truecolor foreground and background exceeded diff-so-fancy’s seven-field escape-sequence limit.

May 7, 2018

The q Family

 2 min About thirty git aliases built on a grammar: q queries, suffix letters add verbs, doubling escalates, a trailing q quiets, and a bang means force.

Apr 18, 2018

diff-so-fancy Without the Pipeline

 2 min A git pager that runs diff-so-fancy inside less via LESSOPEN and degrades to plain less on machines that don’t have it.

Apr 15, 2018

Exit 99

 2 min Dotfiles that fast-forward themselves at login and re-exec the running shell, coordinated by one exit code.

Apr 11, 2018

The FETCH_HEAD Throttle

 2 min date -r FETCH_HEAD as the entire last-fetch database: no state file, a 12-hour window, and an epoch backdate to force retries.

Apr 9, 2018

cognito

 3 min A tiny shell private mode that stops history, makes up-arrow forget, and hides its own switches.

Mar 28, 2018

mkdir elects one builder

 3 min Atomic directory creation elects one builder, but every error is treated as a lost race and losers continue before the winner is ready.

Mar 27, 2018

Where Shell Hides Bugs

 4 min Three latent shell bugs from my own repos: a config knob wired to nothing, a readability cleanup that inverted a boot flow, and a bashism hidden by discarded error output.

Aug 14, 2014

The polyglot activate script

 2 min zippy’s bin/activate was six lines valid in both bash and Python, and sourcing it executed itself to print its own exports.

Jun 5, 2014

[b]in

 2 min Wrapping one letter in a character class turns every PATH candidate into an existence test.

Jan 28, 2013

$JAVA_OPTS is an argv problem

 2 min One variable string becomes one argument or several depending on who tokenizes it—verify the argv, not the config text.

Jul 27, 2012

Process substitution as a pipe endpoint

 2 min A successful read-write open retains a process substitution’s pipe for independently launched producers and consumers.

Mar 10, 2012

Dropping a job from Bash’s table

 2 min A Bash idiom let an outer subshell finish while a grandchild kept running; it was a narrow SSH workaround, not portable daemonization.

Mar 10, 2012

Sourcing generated shell is still execution

 2 min Using /dev/stdin avoids eval’s call-site quoting hazard and keeps generated code inspectable; it does not reduce the injection surface.

Mar 10, 2012

Appending compressed logs

 1 min An old mirror script appended complete gzip members, letting each run add compressed output without reopening the previous stream.

Oct 31, 2011

The prompt that asks the kernel

 2 min A bashrc derived container identity from /proc/self/cgroup and prefixed the prompt with VPS[name]—no environment variable involved.

Feb 11, 2010

The directory is the dispatch table

 3 min vps-lxc discovered its subcommands by listing a directory, with one sed filter as the entire registration policy.

Feb 11, 2010

Containers in 2010

 6 min vps-lxc: templates as btrfs subvolumes, containers as writable snapshots, and the host-local image model I built around them.

Feb 11, 2010

A cleanup stack in Bash

 3 min vps-lxc registers cleanup handlers in an array and unwinds them newest-first on fatal errors or signals.

Feb 11, 2010
No matching items