>_ZSHRS REFERENCE
The most powerful shell ever created. No-fork architecture, AOP intercept, worker thread pool, bytecode caching, fusevm compiled execution.
SHELL SCRIPTS AT MACHINE CODE SPEED.
NO FORK. NO INTERPRETER. JUST BYTECODES.
For the first time in the history of computing — since the dawn of Unix at Bell Labs
in 1970 — a shell compiles to executable bytecodes and runs them on a virtual machine
with fused superinstructions. Every interactive command line, every shell script,
every function invocation, every source’d file compiles to fusevm bytecodes
and executes at near-machine-code speed. No tree-walking interpreter. No fork. No parsing at
runtime if bytecodes are cached.
Compiled bytecodes are cached as rkyv zero-copy archives mmap'd directly into
memory. Function invocations deserialize cached bytecodes
in microseconds — skipping the lexer, parser, and compiler entirely. source’d
scripts and interpreted scripts follow the same path: compile once, cache, execute from bytecode
forever. This has never been achieved in a Unix shell.
[0x00a] INVENTIONS — THE LIST
This is a legacy, not a battle. Every item below originated in
zshrs and is offered as prior art for the shell-design
commons under the MIT grant. Future shells (bash, fish,
nushell, elvish, oil, xonsh, murex, projects that don’t exist
yet) should inherit any of it. Ports must credit zshrs as the
invention source in their docs — see
CREATORS.md
for the suggested wording. The protected invariants in
MAINTAINERS.md
guard upstream identity, not the ideas.
Compiled Unix shell
First Unix shell to compile every command (interactive, script, function, sourced file) to bytecode and execute on a purpose-built VM. Every shell since Bell Labs 1970 has been an interpreter.
fusevm bytecode VM
NaN-boxed register VM with fused superinstructions and a Cranelift JIT for hot blocks. Shared substrate with stryke so a shell and a scripting language ride the same value representation.
Zsh grammar introspection to stdout
First shell to emit, in canonical diffable formats, zsh’s
lexer token stream, wordcode (Eprog) layout, and a
structured parser AST (S-expression) — the zshrs
binary (--dump-tokens, --dump-wordcode,
--dump-ast) and the matching zshrs_dump
loadable module (dumptokens, dumpwordcode).
Stock zsh does not ship this trio as a user-facing pipeline.
Fusevm bytecode on argv (--disasm)
The zshrs binary prints the fusevm op listing
(name pool, subroutine entries, each opcode, nested
sub_chunks) to stdout before every VM run —
the IR the shell actually executes, next to the lexer/AST/wordcode
dump trio. Stock zsh does not expose its internal wordcode VM stream
on argv this way.
Persistent worker thread pool
18 (configurable [2-18]) tokio threads owned by the shell.
$(cmd), <(cmd), &,
globbing, completion, autoloading all dispatch to the pool
instead of fork(2). Zero forks in the hot path.
90/10 daemon / shell split
Singleton zshrs-daemon owns every mutation
(canonical state, fsnotify, schedule, jobs, locks, cache,
history). Thin shell clients are stateless and forkable.
No shared writer, no second process tree, no auto-spawn.
Recorder-owns-rebuild (AOP intercept)
zshrs-recorder AOP-intercepts every state-mutating
dispatcher at runtime — alias / function / export / fpath
edit / hash -d / zstyle / bindkey / compdef / zmodload /
setopt / trap / sched / source / assignment — and ships
(kind, name, value, file, line, fn_chain) to the daemon.
Replaces the static-walker approach every other shell uses for
completion / fpath scanning.
rkyv canonical-state shards
Daemon's in-memory canonical state persists as
content-addressed rkyv archives under
~/.zshrs/images/. Cold-start shells mmap the
shard and skip every dotfile in /etc + ~.
~10ms cold-start vs >100ms re-source.
Single ~/.zshrs/ directory rule
Every config + log + sqlite + rkyv shard + socket lives
under one root. $ZSHRS_HOME overrides for
sandboxes / hermetic harnesses. rm -rf ~/.zshrs/
is the one-verb total reset.
Three log files, one per binary
zshrs.log (shell) + zshrs-daemon.log +
zshrs-recorder.log — never interleaved. One
paths::is_zshrs_log_file matcher feeds rotation,
tail, clear, snapshot bundling.
Three TOML configs, all auto-seeded
zshrs.toml + zshrs-daemon.toml +
zshrs-recorder.toml with documented defaults.
Every binary seeds the dir on first run; idempotent across
all four. Auto-migrates legacy daemon.toml →
zshrs-daemon.toml.
z* builtin family
One namespace, twenty-three builtins, one daemon route.
zcache, zls, zid, zping,
ztag, zsend, znotify,
zsubscribe, zjob, zsync,
zask, zhistory, zsource,
zcomplete, zsuggest, zlog,
zwhere, zd, zlock,
zpublish.
Cross-shell pub/sub + named locks
zsubscribe / zpublish /
zlock as builtins routed through the singleton
daemon. Replaces flock + socat + named
pipes glued by hand. Locks are token-issued; release requires
the original token (lost shell can’t accidentally release
someone else’s lock).
Session-persistent supervised jobs
zjob submit spawns under the daemon — survives
shell exit, output captured to disk, status persisted in
catalog.db, history survives daemon restarts. Replaces
nohup + screen + pueue +
disown.
Bidirectional ptmx zjob attach
--pty submit allocates a pseudo-terminal pair;
child runs with slave on 0/1/2.
zjob attach switches client termios to raw mode,
pumps stdin via job_input (base64), drains daemon
broadcast back to user’s tty, propagates SIGWINCH via
job_resize. Ctrl-] detaches; job keeps running.
Solves bg-jobs-blocked-on-stdin.
Auto-derived OpenAPI 3.1
GET /openapi serves a spec-compliant OpenAPI
doc generated on every request from the daemon’s op
registry (OP_NAMES). 108 paths today (4 meta + 101
ops + 3 stream routes). bearerAuth declared only when
[http.tokens] is populated. Loopback bind requires
no token; non-loopback bind refuses without one.
Daemon HTTP listener default-on (loopback)
Seeded zshrs-daemon.toml ships
[http] listen = "127.0.0.1:7733" so
zd health works out of the box. Same trust model as
the Unix socket on a single-user box; flips to required-auth
the moment the bind goes non-loopback.
zd — HTTP bin AND in-process builtin
Same arg surface, two transports.
zd the binary uses ureq against the HTTP listener
(works from bash / fish / CI / curl). zd the builtin
inside zshrs uses the local Unix socket via the daemon
Client — 5.5× faster (0.48ms vs 2.64ms,
no fork).
zd doctor
One-command health sweep: cache-root perms, file-perms drift,
pidlock liveness, socket presence, catalog integrity (sqlite
PRAGMA integrity_check), shards-present count,
fsnotify-alive, supervised-job count, legacy-litter scan
(~/.zcompdump*, ~/*.zwc). Pretty
ASCII table; non-zero exit on any FAIL.
Flat history + sibling FTS5 sqlite
~/.zshrs/zshrs_history (flat zsh-extended-history
text, cat-able and grep-able) +
~/.zshrs/zshrs_history.db (FTS5 index for fast
search / dedup / frequency). The writer keeps both in lockstep;
on open, the text mirror is rehydrated from the index if
stale. Auto-migrates the legacy
~/Library/Application Support/zshrs/history.db.
Recorder sources the full 8-file login chain
zshrs-recorder by default mirrors a real
zsh -l -i: /etc/zshenv,
${ZDOTDIR:-$HOME}/.zshenv, /etc/zprofile,
~/.zprofile, /etc/zshrc,
~/.zshrc, /etc/zlogin,
~/.zlogin. Missing files skipped silently.
$ZDOTDIR re-resolved per file.
zsync up --all
Single command snapshots every overlay table
(alias / galias / salias / setopt / params /
env / path / manpath / fpath / named_dir / compdef /
zstyle) and pushes into the daemon’s canonical state.
Shell-side overlay_snapshot::enumerate_all_overlays
registered via fn-pointer trampoline so the daemon crate
stays decoupled from ShellExecutor.
23 anti-fork coreutils builtins
cat, head, tail,
wc, sort, find,
uniq, cut, tr,
seq, rev, tee,
sleep, date, mktemp,
hostname, uname, whoami,
id, basename, dirname,
touch, realpath. All in-process; one
cat in a pipeline doesn’t fork.
Parallel-as-syntactic-primitive
fish-style parallel iterators (par_for,
par_map, par_filter, par_reduce)
ship as VM opcodes, not library calls. Glob walks parallelize
at depth ≥ 32 by default. Worker pool is the substrate.
The --no-fork philosophy as a measurement
Every accepted commit is graded by “does this remove a fork?” not “does this add a feature?” Optimization layers (zinit turbo, p10k instant prompt, zwc, zcompile, BG_NICE, lazy autoload) are evidence that zsh can’t solve the problem in userspace; zshrs accepts the architecture cost to solve it for real.
First shell with native LSP server + DAP debug adapter
World’s first shell to ship Language Server
Protocol and Debug Adapter Protocol as first-class subsystems
of the shell binary itself. zshrs --lsp
starts an LSP server on stdio (completion, hover,
documentSymbol, foldingRange, semanticTokens, formatting,
rename, diagnostics) consumed by any editor — JetBrains,
VS Code, Helix, Neovim. zshrs --dap HOST:PORT
speaks the full Debug Adapter Protocol over TCP (breakpoints,
stepping, frames, scopes, variables, evaluate) so any DAP
client can debug zsh scripts. No other shell (bash, zsh,
fish, nu, elvish, oil, xonsh, murex) ships either —
bash-language-server is a Node-based third-party project,
not part of bash; no zsh equivalent exists at all. The
JetBrains plugin at editors/intellij/ drives
both. Hand-rolled JSON-RPC framing, zero new dependencies.
First POSIX-compatible shell with a builtin unit-test framework
World’s first POSIX-compatible shell to ship
a unit-test framework + worker-pool runner in the binary,
zero external install. zassert_eq /
zassert_ne / zassert_ok /
zassert_gt / zassert_lt /
zassert_match / zassert_contains /
zassert_near / zassert_dies —
14 assertion verbs — plus ztest_skip and
ztest_run (alias run_tests) are
shell builtins, callable from any .zsh / .sh
script with no npm i, gem install,
or cargo install step. zshrs --ztest [paths…]
runs a worker-pool: N persistent --ztest-worker
subprocesses (one per CPU) fork-on-receive per test, JSON-over-pipe
wire protocol, per-test fd 2 capture so concurrent workers
never tear each other’s output — the same architecture
cargo-nextest brought to Rust testing, now in
a shell binary. Every other POSIX-family shell (bash, zsh,
ksh, dash, fish) relies on third-party packages installed
separately: bats-core, shunit2,
Bach, ShellSpec, zunit,
korn-spec. PowerShell’s Pester (preinstalled
on Windows 10+) is the closest precedent, but PowerShell
is not POSIX. Nushell ships std assert builtins
but is its own non-POSIX language and has no integrated
runner. Lives in src/extensions/ztest.rs; port
of strykelang’s stryke test runner.
Full enumeration + suggested attribution wording in
CREATORS.md.
Op-by-op detail in daemon-report.html.
Port-coverage report in report.html.
[0x00] THE COMPILATION PIPELINE
Every path through zshrs ends at the same place: fusevm bytecode execution.
| Path | Lex | Parse | Compile | Execute | Cache |
|---|---|---|---|---|---|
| Interactive command | Yes | Yes | Yes | fusevm | No (ephemeral) |
| Script file (first run) | Yes | Yes | Yes | fusevm | Yes → rkyv |
| Script file (cached) | No | No | No | fusevm | Hit → deserialize |
| Autoload function (cached) | No | No | No | fusevm | Hit → deserialize |
| Plugin source (cached) | No | No | No | fusevm | Delta replay → µs |
[0x01] ARCHITECTURE
Source-tree layout: ported / extensions / recorder split
The runtime crate is physically split so port code and original code can never be confused. Bots, contributors, and humans all read docs/PORT.md before writing a single line of code; tests/port_purity.rs mechanically enforces the rules in CI.
src/ported/— 107 files, FROZEN. Strict 1:1 port. Every.rsmirrors a realsrc/zsh/Src/<x>.cfile (same stem, same relative subpath). Every top-levelfncarries a/// Port of <cname>() from Src/<file>.c:NNNNdoc-comment. New file creation is banned; new fn names that don't exist in upstream zsh C source are banned. The freeze closes both drift vectors: bots invent helper names ("shell_quote", "find_in_path") and bots create fresh files to drop helpers in. Both blocked.src/extensions/— 40 files. The non-port directory. Features zsh C demonstrably does not have: AOT (aot.rs,compile_zsh.rs), autoload/plugin/script caches, fish-style autosuggest/abbrev/highlight, persistent worker pool, arith JIT, AST s-exp dump, ZWC byte-code helpers, recorder hooks, daemon presence, structured logging, ZLE keymaps/widgets, ext builtins, regex module, config, overlay snapshot + canonical apply, subscript/fds/hist extensions.port_purityexempts this directory from the 1:1 file-existence rule on the basis that no C ancestor exists.src/recorder/— 1 file, feature-gated. Every symbol#[cfg(feature = "recorder")]; deleted by rustc when the feature is off. Compiled into the separatezshrs-recorderbinary, never the defaultzshrsbuild.src/zsh/— vendored upstream. Read-only reference. The C spec; never modified.
Lexer + parser ports live in src/ported/lex.rs and src/ported/parse.rs (no separate parse/ crate). Workspace sibling: daemon/ (41 files, zshrs-daemon); compsys was folded into the main zshrs crate (no longer a standalone sibling). Top-level dirs: fish/ (157 files, fish-style reader/highlighter/abbreviations), bins/ (4 entry points: zshrs, zshrs-recorder with required-features = ["recorder"], zd with required-features = ["zd"], bench-autoload). 609 .rs files total · 645,344 Rust LOC (git ls-files '*.rs' | xargs wc -l, 2026-06-05). Test count: 14,552 #[test] markers across the tree.
[0x01] ANTI-FORK ARCHITECTURE
Every fork is a full process copy. On macOS, fork() costs 2-5ms
including exec + ld.so + libc init. zsh forks for every
$(...), <(...), cat, grep, subshell, and completion.
zshrs forks for none of them.
| Operation | zsh | zshrs | Speedup |
|---|---|---|---|
cat file | fork + exec /bin/cat | Builtin — zero fork | 2000-5000x |
head/tail/wc | fork + exec | Builtin — zero fork | 2000-5000x |
sort/find/uniq | fork + exec | Builtin — zero fork | 2000-5000x |
date/hostname/uname | fork + exec | Direct syscall | 3000-8000x |
sleep/mktemp/touch | fork + exec | Builtin — zero fork | 2000-5000x |
xattr operations | fork + exec xattr | Direct syscall | 2000-5000x |
pmap/pgrep/peach | fork N times to sh -c | VM execution — zero fork | Nx |
$(cmd) | fork + pipe + exec | In-process stdout capture via dup2 | — |
<(cmd) / >(cmd) | fork + FIFO | Worker pool thread + FIFO | — |
Glob **/*.rs | Single-threaded opendir | Parallel walkdir per-subdir on pool | — |
rehash | Serial readdir per PATH dir | Parallel scan across pool | — |
| Autoload function | Read file + parse every time | Zero-copy mmap of rkyv-archived bytecode (µs) | 100x |
Coreutils Builtins (23 commands, zero fork)
Every invocation of these commands is 2000-5000x faster than forking to the external binary.
[0x02] WORKER THREAD POOL
Persistent pool of warm threads. Bounded crossbeam channel with backpressure. Panic recovery keeps workers alive. Task cancellation on Ctrl-C. Instant shutdown on exit.
Tasks shipped to the pool:
compinit
Background fpath scan + bytecode compilation of 16K+ functions
Process Sub
<(cmd) and >(cmd) on pool threads instead of fork
Parallel Glob
**/ recursive walk split per-subdir across pool
Metadata Prefetch
Glob qualifiers: one parallel stat batch, zero syscalls after
PATH Rehash
Parallel readdir across every PATH directory
History Writes
Daemon-side writes via IPC — prompt never waits, zero client SQLite handle
[0x03] AOP INTERCEPT
The first shell ever with aspect-oriented programming. Hook before,
after, or around any command or function
— at machine code speed, no fork. One primitive that replaces defer,
profile, memo, retry, and timeout.
Variables available in advice:
| Variable | Available | Description |
|---|---|---|
$INTERCEPT_NAME | all | Command name |
$INTERCEPT_ARGS | all | Arguments as space-separated string |
$INTERCEPT_CMD | all | Full command string |
$INTERCEPT_MS | after | Execution time in milliseconds (nanosecond source) |
$INTERCEPT_US | after | Execution time in microseconds |
$? | after | Exit status |
[0x04] RKYV ZERO-COPY CACHE LAYER
Cached bytecode lives in rkyv archives mmap'd by clients — zero-copy
deserialization, no allocator pressure on hot paths. The daemon owns all writes; clients
only mmap. The single queryable mirror is catalog.db (SQLite) for
dbview introspection — never touched on the hot path.
images/{hash}-{slug}.rkyv
Per-source-root rkyv shards. Compiled bytecode for autoloads, plugins, sourced scripts. Daemon writes; clients mmap zero-copy. Validates with rkyv's bytecheck on first access; format-versioned for migration safety.
index.rkyv
Top-level shard index: source-root path → shard hash + mtime. Daemon rewrites on changes; clients mmap to resolve which shard to load.
catalog.db (SQLite mirror)
Daemon-hydrated FTS5-indexed mirror of all rkyv contents. Used ONLY by
dbview and zcache introspection — never read on the
hot path. Clients have ZERO SQLite handles. The daemon's own FTS5 history
(history.db) sits next to it; the shell's user-facing history is
zshrs_history (flat zsh-extended-history-format text) plus a sibling
FTS5 index zshrs_history.db, both in $ZSHRS_HOME.
Browse caches without SQL:
[0x04b] FILE LAYOUT & BINARIES
One directory holds every zshrs file: $ZSHRS_HOME (defaults to
~/.zshrs/). All four binaries — zshrs, zshrs-daemon,
zshrs-recorder, zd — seed the directory and three default configs
on first run via CachePaths::ensure_default_configs. Idempotent — never
overwrites user edits. Auto-migrates legacy daemon.toml →
zshrs-daemon.toml and the legacy macOS history at
~/Library/Application Support/zshrs/history.db →
~/.zshrs/zshrs_history.db.
Three log files (one per binary)
| File | Owner | Level source |
|---|---|---|
zshrs.log | shell | [log] level in zshrs.toml (env $ZSHRS_LOG wins) |
zshrs-daemon.log | daemon | [log] level in zshrs-daemon.toml |
zshrs-recorder.log | recorder | [log] level in zshrs-recorder.toml |
Helper paths::is_zshrs_log_file matches all three for rotation, tail, and
clear. Default daemon startup emits 7 INFO lines; with level = "trace" an
additional ~5 startup diagnostics print (resolved env, pidlock, db sizes, ticker spawn,
schedule spawn, http listener address).
[shell] skip_configs = "auto"
When the daemon is up AND has a recorded zshrs canonical shard, the shell SKIPS
sourcing /etc/zshenv + ~/.{zshenv,zprofile,zshrc,zlogin} entirely
and rebuilds executor state from the rkyv shard. canonical_apply wires
alias/galias/salias/env/params/setopt/path/fpath/named_dirs/autoload_functions/zstyle/bindkey/compdef/zle widgets.
Inline functions are deferred until the recorder ships bytecode in the shard.
[0x04c] RECORDER (zshrs-recorder)
Separate binary — not a flag on zshrs. Sources the full zsh login
chain in order, skipping any missing file silently:
-f PATH overrides the chain to source one file. End-of-run ships a
recorder_ingest IPC bundle to the daemon, which folds it into the canonical
shard for the matching source root.
[0x04d] zd — TWO SURFACES
| Surface | Transport | Latency | Use case |
|---|---|---|---|
zd binary | HTTP via ureq to [http].listen | 2.64 ms (fork+exec) | bash, fish, CI, anything outside zshrs |
zd builtin (in-process) | local Unix socket via Client | 0.48 ms (5.5× faster) | inside zshrs — same arg surface |
Default HTTP listener: 127.0.0.1:7733, seeded into
zshrs-daemon.toml on first run so zd health works out of the
box. Default token comes from $DAEMON_TOKEN. Loopback bind requires no
token; non-loopback bind refuses to start until [http.tokens] is populated.
GET /openapi (alias /openapi.json) returns an OpenAPI 3.1
document auto-derived from OP_NAMES — 108 paths today (4 meta + 101 ops
+ 3 streams), with ErrPayload in components and bearerAuth
declared only when tokens are configured.
zd subcommands
zd export aliases pdf > out.pdf produces a real PDF — payload is
streamed direct for sh / csv / json / yaml / text / pdf. --json
opt-in restores the JSON envelope.
[0x04e] NEW z* BUILTINS
| Builtin | Description |
|---|---|
zlock try NAME | Cross-process named lock — non-blocking try |
zlock acquire NAME [--timeout S] | Poll-wait acquire with optional timeout |
zlock release NAME TOKEN | Release by token |
zlock list | List all held locks |
zpublish TOPIC / TOPIC DATA / TOPIC --json '{...}' | Producer side of the pub/sub bus (consumer is zsubscribe) |
zwhere SUBSYS NAME | Query daemon canonical state for "where did this alias / function / zstyle come from" with file:line attribution |
Full builtin family: zcache, zls, zid,
zping, ztag, zuntag, zsend,
znotify, zsubscribe, zunsubscribe,
zjob, zsync, zask, zhistory,
zsource, zcomplete, zsuggest,
zcmd-result, zlog, zwhere, zd,
zlock, zpublish.
zjob — bidirectional ptmx attach
With --pty the daemon calls nix::pty::openpty() and the
child runs with the slave on 0/1/2 via pre_exec dup2; the
master fd lives in JobMeta. Two new IPC ops drive it:
job_input {id, bytes_b64}— base64-decode, write to masterjob_resize {id, rows, cols}—TIOCSWINSZfor SIGWINCH propagation
On zjob attach against a pty job: termios cfmakeraw on
stdin, a stdin reader thread batches keystrokes and fires job_input, output
is broadcast as job:N.stdout events with bytes_b64 payload
(decoded back to the user's tty), and SIGWINCH is forwarded as
job_resize. Ctrl-] is the detach key. Termios is restored on
exit via a Drop guard. Use case: background jobs that block on stdin (deploy scripts
asking y/n, REPLs in background) — submit with --pty, attach later, type,
detach, attach again.
zsync up --all
Now wired (was a stub). The shell-side enumerator
(src/extensions/overlay_snapshot.rs) snapshots every overlay table and ships
push_canonical per subsystem. Covers
alias/galias/salias, setopt, params (vars+arrays+assoc unioned), env, path, manpath,
fpath, named_dir, compdef, zstyle. Skipped: function (needs source-text
round-trip), bindkey (lives in ZleManager),
zmodload (no canonical "currently loaded" list).
[0x05] BYTECODE CACHING
Every autoload function in fpath gets compiled to fusevm bytecodes during compinit.
Compiled chunks are serialized via rkyv into per-source-root shards and written
by the daemon. Subsequent loads mmap the archive zero-copy, validate via bytecheck,
and dispatch directly — no lex, no parse, no compile, no allocator hit.
[0x06] FUSEVM BYTECODE TARGET
100% lowered. Every shell construct compiles to fusevm
bytecodes — a language-agnostic VM with fused superinstructions and Cranelift JIT.
The same VM that powers stryke (which beats LuaJIT on benchmarks). No tree-walking
interpreter remains. Hot bytecodes compile to native x86-64 machine code.
Shell constructs already lowered to fusevm bytecodes:
Arithmetic
$(( )) — full precedence, ternary, assignment, hex/octal, bitwise
Loops
for, for(()), while, until, repeat
Conditionals
if/elif/else, case, [[ ]] with all file tests and comparisons
Commands
Exec, ExecBg, pipelines, redirects, here-docs, here-strings
Functions
Definition, Call/Return, PushFrame/PopFrame
Fused Ops
AccumSumLoop, SlotIncLtIntJumpBack, PreIncSlotVoid — single-dispatch loop execution
[0x07] EXCLUSIVE BUILTINS
Parallel Primitives (VM-executed, zero fork)
| Builtin | Description |
|---|---|
async / await | Ship work to pool, collect result |
pmap | Parallel map with ordered output — compiles to bytecode, runs on VM, zero forks |
pgrep | Parallel filter — compiles to bytecode, runs on VM, zero forks |
peach | Parallel for-each, unordered — compiles to bytecode, runs on VM, zero forks |
barrier | Run all commands in parallel, wait for all |
AOP / Debugging
| Builtin | Description |
|---|---|
intercept | AOP before/after/around advice on any command. Glob pattern matching. Nanosecond timing. |
intercept_proceed | Call original command from around advice. |
doctor | Full diagnostic: worker pool metrics, cache stats, bytecode coverage, startup health. |
dbview | Browse the daemon's catalog.db mirror without SQL. Tables: autoloads, comps, executables, history, plugins. Hot path uses rkyv mmap directly. |
profile | In-process command profiling. Nanosecond accuracy. No fork overhead in measurement. |
Unit Test Framework
Port of the strykelang test framework
(stryke test → zshrs --ztest). Worker-pool runner — one persistent
--ztest-worker subprocess per CPU, fork-on-receive per test file, JSON-over-pipe wire protocol,
per-test fd 2 capture so concurrent workers can’t tear each other’s lines.
Test discovery: test_* / t_* prefix × .zsh/.sh/.zshrs
suffix under t/ or tests/.
| Builtin | Description |
|---|---|
zassert_eq / zassert_ne | String equality / inequality |
zassert_ok / zassert_err / zassert_true / zassert_false | Truthiness (non-empty AND not "0" → truthy) |
zassert_gt / zassert_lt / zassert_ge / zassert_le | Numeric ordering |
zassert_match | Regex match (Rust regex syntax) |
zassert_contains | Substring containment |
zassert_near | Float approximate equality (epsilon) |
zassert_dies | Passes when given shell command exits non-zero |
ztest_skip | Mark current assertion skipped (yellow ↓) |
ztest_run / run_tests | Print summary, roll counters into totals |
zshrs --ztest [-j N] [-q] [paths…] | Worker-pool runner (default workers = num_cpus) |
zshrs --ztest-worker | Persistent worker subprocess (JSON over stdin/stdout) |
Coreutils (Anti-Fork)
| Builtin | Description | Speedup vs fork |
|---|---|---|
cat | Concatenate files — no fork | 2000-5000x |
head / tail | First/last N lines — no fork | 2000-5000x |
wc | Line/word/char count — no fork | 2000-5000x |
sort / uniq | Sort and dedupe — no fork | 2000-5000x |
find | Walk directories — no fork | 2000-5000x |
cut / tr / rev | Text manipulation — no fork | 2000-5000x |
seq / tee | Number sequences, copy stdin — no fork | 2000-5000x |
date | Current date/time — direct strftime | 3000-8000x |
sleep | Delay — std::thread::sleep | 2000-5000x |
mktemp | Create temp file/dir — no fork | 2000-5000x |
hostname / uname | System info — direct syscall | 3000-8000x |
id / whoami | User info — direct syscall | 3000-8000x |
touch / realpath | File ops — no fork | 2000-5000x |
basename / dirname | Path manipulation — no fork | 2000-5000x |
zgetattr / zsetattr | xattr ops — direct syscall | 2000-5000x |
[0x07b] SHELL LANGUAGE FEATURES
Every shell construct compiles to fusevm bytecode — no tree-walker dispatch lives in zshrs. The categories below are summaries; the full reference documents each entry with a runnable code example.
Control Flow
if, while, until, for, for ((;;)),
case, select, coproc, break, continue,
return, ;/&&/||/&.
Indexed Arrays
arr=(a b c), arr+=(d), ${arr[1]} (1-based),
${arr[-1]}, ${arr[@]} (argv splice), ${#arr[@]}.
Associative Arrays
typeset -A m, m[key]=val, ${m[key]},
${(k)m} (keys), ${(v)m} (values).
Parameter Expansion
${var:-x}, ${var:=x}, ${var:?msg},
${var:+x}, ${#var}, ${var:o:l}, ${var#pat},
${var/pat/repl}, ${var:u}/:l.
Zsh Flags
(L)/(U) case, (j: :) join,
(s. .) split, (f) newline-split, (o)/(O) sort,
(P) indirect, (@) force-array, (k)/(v),
(#). Stack: (jL), (s:,:U).
Redirects & Pipelines
> >> < <<EOF <<<
2>&1 &> &>> |
|& ! <(cmd) >(cmd).
Background & Async
cmd & (fork + setsid), $!, wait,
jobs/fg/bg; async/await
(worker pool, no fork).
Coprocesses
coproc { body } creates two pipes, forks, registers
$COPROC=[read_fd, write_fd]. Read from /dev/fd/${COPROC[1]},
write to /dev/fd/${COPROC[2]}.
Eval & Indirect Dispatch
eval 'echo $x' defers expansion correctly (single-quoted specials honored).
cmd=ls; $cmd routes through host intercepts.
Arithmetic
$((expr)), (( cond )), let; full integer expression
grammar compiled inline (no runtime parser).
Glob & Brace
*.rs, **/*.rs (parallel walk), {a,b,c},
{1..10}, glob qualifiers *(.x) *(N).
Tilde & Cmd-Sub
~, ~user, ~+/~-; $(cmd)
(in-process pipe-capture), backticks.
For the complete catalog — every supported builtin, keyword, parameter-expansion form, ZshFlag, AOP primitive, parallel primitive, and anti-fork coreutils replacement with a code example for each — see the FULL REFERENCE.
[0x08] INSTALL
[0x09] DIAGNOSTICS
[0x09b] ZSH CORPUS — LINE COUNTS & EXAMPLE SCRIPTS
Every *.zsh file shipped under this repo — parity corpus,
recorder corpus, lexer corpus, demo scripts, the upstream src/zsh/Test
harness, and the per-plugin test_corpus/. Counts and source bodies
below are regenerated from the working tree by
scripts/gen_zsh_corpus.py; never hand-edit.
Generated 2026-05-31 by scripts/gen_zsh_corpus.py. All counts derived live from find . -name '*.zsh'; never hand-edit numbers in this section.
Per-group totals
| Group | Files | LOC | Share |
|---|---|---|---|
examples | 368 | 36,994 | 66.7% |
tests/recorder_corpus | 32 | 11,392 | 20.5% |
test_corpus | 28 | 4,090 | 7.4% |
tests/lexer_corpus | 33 | 1,881 | 3.4% |
src/zsh | 2 | 659 | 1.2% |
tests/parity_corpus | 128 | 488 | 0.9% |
| TOTAL | 591 | 55,504 | 100.0% |
Top 10 by LOC
| Path | LOC |
|---|---|
tests/recorder_corpus/zinit/zinit-autoload.zsh | 3,616 |
tests/recorder_corpus/zinit/zinit.zsh | 3,351 |
tests/recorder_corpus/zinit/zinit-install.zsh | 2,451 |
tests/recorder_corpus/zshrc/zshrc.zsh | 889 |
examples/demos/361_json_parser_full.zsh | 708 |
test_corpus/zsh-z.plugin.zsh | 698 |
examples/demos/363_arith_expr_evaluator.zsh | 697 |
examples/demos/365_mini_lisp.zsh | 693 |
src/zsh/Test/ztst.zsh | 631 |
test_corpus/ztst.zsh | 631 |
Full inventory
Full inventory — 591 files (click to expand)
| Path | LOC |
|---|---|
| examples | |
examples/daemon-shell.zsh | 575 |
examples/demos/01_hello.zsh | 7 |
examples/demos/02_arithmetic.zsh | 24 |
examples/demos/03_strings.zsh | 29 |
examples/demos/04_arrays.zsh | 29 |
examples/demos/05_assoc_arrays.zsh | 34 |
examples/demos/06_control_flow.zsh | 43 |
examples/demos/07_for_loops.zsh | 37 |
examples/demos/08_functions.zsh | 49 |
examples/demos/09_recursion.zsh | 43 |
examples/demos/100_zsh_features_summary.zsh | 76 |
examples/demos/101_subshell_grouping.zsh | 61 |
examples/demos/102_function_introspection.zsh | 57 |
examples/demos/103_exit_traps_advanced.zsh | 64 |
examples/demos/104_strict_arithmetic.zsh | 57 |
examples/demos/105_dispatch_table.zsh | 88 |
examples/demos/106_pipe_chains.zsh | 52 |
examples/demos/107_eval_metaprogramming.zsh | 74 |
examples/demos/108_globsubst_globalias.zsh | 57 |
examples/demos/109_arith_truth_tables.zsh | 69 |
examples/demos/10_fizzbuzz.zsh | 13 |
examples/demos/110_misc_advanced.zsh | 87 |
examples/demos/111_let_builtin.zsh | 48 |
examples/demos/112_assignment_forms.zsh | 68 |
examples/demos/113_tied_arrays.zsh | 43 |
examples/demos/114_local_modifiers.zsh | 70 |
examples/demos/115_param_strip_advanced.zsh | 53 |
examples/demos/116_cond_numeric_ops.zsh | 72 |
examples/demos/117_backref_replacement.zsh | 60 |
examples/demos/118_recursive_glob.zsh | 45 |
examples/demos/119_background_wait.zsh | 71 |
examples/demos/11_fibonacci.zsh | 39 |
examples/demos/120_utf8_strings.zsh | 66 |
examples/demos/121_mini_cat.zsh | 86 |
examples/demos/122_mini_grep.zsh | 93 |
examples/demos/123_mini_wc.zsh | 93 |
examples/demos/124_url_encode.zsh | 67 |
examples/demos/125_json_pretty.zsh | 65 |
examples/demos/126_xml_escape.zsh | 51 |
examples/demos/127_string_trim.zsh | 95 |
examples/demos/128_csv_writer.zsh | 56 |
examples/demos/129_assoc_serialize.zsh | 66 |
examples/demos/12_quicksort.zsh | 38 |
examples/demos/130_ini_parser.zsh | 102 |
examples/demos/131_emulate_modes.zsh | 68 |
examples/demos/132_ksh_patterns.zsh | 62 |
examples/demos/133_zstyle_demo.zsh | 55 |
examples/demos/134_compdef_signatures.zsh | 85 |
examples/demos/135_bindkey_config.zsh | 44 |
examples/demos/136_path_manipulation.zsh | 66 |
examples/demos/137_named_pipes.zsh | 35 |
examples/demos/138_lock_files.zsh | 98 |
examples/demos/139_env_manipulation.zsh | 67 |
examples/demos/13_prime_sieve.zsh | 36 |
examples/demos/140_signal_handling.zsh | 64 |
examples/demos/141_color_codes.zsh | 58 |
examples/demos/142_calc_engine.zsh | 94 |
examples/demos/143_todo_app.zsh | 98 |
examples/demos/144_graph_bfs.zsh | 123 |
examples/demos/145_state_machine.zsh | 49 |
examples/demos/146_topological_sort.zsh | 89 |
examples/demos/147_pomodoro_timer.zsh | 59 |
examples/demos/148_inventory_system.zsh | 82 |
examples/demos/149_event_log.zsh | 74 |
examples/demos/14_brace_expansion.zsh | 29 |
examples/demos/150_lru_cache.zsh | 89 |
examples/demos/151_priority_queue.zsh | 28 |
examples/demos/152_bloom_filter.zsh | 63 |
examples/demos/153_trie.zsh | 73 |
examples/demos/154_levenshtein.zsh | 63 |
examples/demos/155_text_diff.zsh | 58 |
examples/demos/156_simple_template.zsh | 63 |
examples/demos/157_observer_pattern.zsh | 83 |
examples/demos/158_simulate_random.zsh | 73 |
examples/demos/159_bank_account.zsh | 88 |
examples/demos/15_parameter_expansion.zsh | 36 |
examples/demos/160_zshrs_capabilities.zsh | 66 |
examples/demos/161_dirstack.zsh | 49 |
examples/demos/162_umask_ulimit.zsh | 63 |
examples/demos/163_quoting_flags.zsh | 58 |
examples/demos/164_z_split_shell.zsh | 48 |
examples/demos/165_print_advanced.zsh | 50 |
examples/demos/166_glob_flags.zsh | 57 |
examples/demos/167_mini_find.zsh | 86 |
examples/demos/168_mini_make.zsh | 62 |
examples/demos/169_markdown_to_text.zsh | 66 |
examples/demos/16_parameter_flags.zsh | 25 |
examples/demos/170_regex_tester.zsh | 50 |
examples/demos/171_moving_average.zsh | 67 |
examples/demos/172_password_check.zsh | 73 |
examples/demos/173_anagram_finder.zsh | 67 |
examples/demos/174_number_to_words.zsh | 79 |
examples/demos/175_ascii_chart.zsh | 89 |
examples/demos/176_game_of_life.zsh | 95 |
examples/demos/177_days_between.zsh | 98 |
examples/demos/178_maze_generator.zsh | 80 |
examples/demos/179_lottery_sim.zsh | 70 |
examples/demos/17_heredocs.zsh | 33 |
examples/demos/180_calendar.zsh | 84 |
examples/demos/181_fizzbuzz_variants.zsh | 76 |
examples/demos/182_progress_bar.zsh | 43 |
examples/demos/183_word_frequency.zsh | 53 |
examples/demos/184_simple_cron.zsh | 68 |
examples/demos/185_final_recap.zsh | 66 |
examples/demos/186_alias_forms.zsh | 59 |
examples/demos/187_hex_dump.zsh | 69 |
examples/demos/188_ip_parser.zsh | 96 |
examples/demos/189_http_status.zsh | 79 |
examples/demos/18_cmd_substitution.zsh | 28 |
examples/demos/190_ansi_stripper.zsh | 61 |
examples/demos/191_retry_backoff.zsh | 71 |
examples/demos/192_memoize.zsh | 85 |
examples/demos/193_log_rotate.zsh | 61 |
examples/demos/194_url_parser.zsh | 99 |
examples/demos/195_sha_simple_hash.zsh | 94 |
examples/demos/196_base64.zsh | 78 |
examples/demos/197_csv_full_parse.zsh | 70 |
examples/demos/198_yaml_lite.zsh | 72 |
examples/demos/199_color_picker.zsh | 55 |
examples/demos/19_pipes_and_filters.zsh | 27 |
examples/demos/200_milestone.zsh | 63 |
examples/demos/201_unit_converter.zsh | 112 |
examples/demos/202_tokenizer.zsh | 94 |
examples/demos/203_argv_dispatch.zsh | 123 |
examples/demos/204_string_interpolation.zsh | 82 |
examples/demos/205_zsh_in_scripts.zsh | 78 |
examples/demos/206_assoc_iteration.zsh | 93 |
examples/demos/207_lru_with_ttl.zsh | 83 |
examples/demos/208_directory_walker.zsh | 92 |
examples/demos/209_command_pipeline.zsh | 85 |
examples/demos/20_process_substitution.zsh | 16 |
examples/demos/210_quine.zsh | 66 |
examples/demos/211_csv_to_md.zsh | 42 |
examples/demos/212_markdown_table.zsh | 79 |
examples/demos/213_ssh_config_parser.zsh | 83 |
examples/demos/214_chess_board.zsh | 63 |
examples/demos/215_tic_tac_toe.zsh | 82 |
examples/demos/216_deck_of_cards.zsh | 98 |
examples/demos/217_guess_number.zsh | 96 |
examples/demos/218_quiz_game.zsh | 53 |
examples/demos/219_madlibs.zsh | 75 |
examples/demos/21_printf_demo.zsh | 28 |
examples/demos/220_expense_tracker.zsh | 90 |
examples/demos/221_zsh_xtrace.zsh | 73 |
examples/demos/222_zsh_psvars.zsh | 80 |
examples/demos/223_funcstack.zsh | 78 |
examples/demos/224_git_log_parser.zsh | 104 |
examples/demos/225_nginx_log_analyze.zsh | 57 |
examples/demos/226_todo_categories.zsh | 99 |
examples/demos/227_hashtable_oa.zsh | 110 |
examples/demos/228_stack_machine.zsh | 112 |
examples/demos/229_search_filter.zsh | 109 |
examples/demos/22_trap_exit.zsh | 20 |
examples/demos/230_menu_system.zsh | 93 |
examples/demos/231_text_adventure.zsh | 100 |
examples/demos/232_time_tracker.zsh | 76 |
examples/demos/233_word_chain.zsh | 60 |
examples/demos/234_simple_kvs.zsh | 93 |
examples/demos/235_grand_finale.zsh | 84 |
examples/demos/236_zsh_hooks.zsh | 69 |
examples/demos/237_zsh_autoload.zsh | 81 |
examples/demos/238_dijkstra.zsh | 113 |
examples/demos/239_sudoku_validate.zsh | 188 |
examples/demos/23_ifs_split.zsh | 26 |
examples/demos/240_lights_out.zsh | 105 |
examples/demos/241_hangman.zsh | 111 |
examples/demos/242_number_sequences.zsh | 127 |
examples/demos/243_sierpinski.zsh | 71 |
examples/demos/244_mandelbrot_ascii.zsh | 92 |
examples/demos/245_toml_parser.zsh | 103 |
examples/demos/246_env_file_parser.zsh | 101 |
examples/demos/247_shebang_detector.zsh | 116 |
examples/demos/248_charset_validator.zsh | 112 |
examples/demos/249_whitespace_normalizer.zsh | 120 |
examples/demos/24_word_count.zsh | 25 |
examples/demos/250_shopping_cart.zsh | 153 |
examples/demos/251_vigenere_cipher.zsh | 103 |
examples/demos/252_caesar_cipher.zsh | 70 |
examples/demos/253_word_search.zsh | 87 |
examples/demos/254_ascii_clock.zsh | 121 |
examples/demos/255_ipv6_parser.zsh | 182 |
examples/demos/256_recipe_converter.zsh | 147 |
examples/demos/257_memory_match.zsh | 117 |
examples/demos/258_substitution_cipher.zsh | 132 |
examples/demos/259_boggle_solver.zsh | 108 |
examples/demos/25_reverse_string.zsh | 29 |
examples/demos/260_final_v3.zsh | 109 |
examples/demos/261_prime_factorize.zsh | 75 |
examples/demos/262_miller_rabin.zsh | 100 |
examples/demos/263_extended_gcd.zsh | 84 |
examples/demos/264_a_star_pathfind.zsh | 138 |
examples/demos/265_kruskal_mst.zsh | 128 |
examples/demos/266_prim_mst.zsh | 97 |
examples/demos/267_floyd_warshall.zsh | 134 |
examples/demos/268_bellman_ford.zsh | 136 |
examples/demos/269_n_queens.zsh | 91 |
examples/demos/26_anonymous_fn.zsh | 33 |
examples/demos/270_fifteen_puzzle.zsh | 125 |
examples/demos/271_hanoi_animated.zsh | 119 |
examples/demos/272_markdown_to_html.zsh | 195 |
examples/demos/273_http_parser.zsh | 146 |
examples/demos/274_log_format_detect.zsh | 128 |
examples/demos/275_csv_merge.zsh | 130 |
examples/demos/276_blackjack.zsh | 168 |
examples/demos/277_dice_game.zsh | 134 |
examples/demos/278_rps.zsh | 125 |
examples/demos/279_xor_cipher.zsh | 140 |
examples/demos/27_positional_args.zsh | 29 |
examples/demos/280_otp_pad.zsh | 138 |
examples/demos/281_zsh_periodic.zsh | 107 |
examples/demos/282_zsh_argv_special.zsh | 127 |
examples/demos/283_zsh_traps_full.zsh | 130 |
examples/demos/284_atomic_write.zsh | 119 |
examples/demos/285_banner_v4.zsh | 109 |
examples/demos/286_segment_tree.zsh | 130 |
examples/demos/287_fenwick_tree.zsh | 143 |
examples/demos/288_kmp_match.zsh | 146 |
examples/demos/289_rabin_karp.zsh | 126 |
examples/demos/28_typeset.zsh | 36 |
examples/demos/290_manacher.zsh | 180 |
examples/demos/291_reservoir_sample.zsh | 148 |
examples/demos/292_skiplist.zsh | 178 |
examples/demos/293_suffix_array.zsh | 161 |
examples/demos/294_word_ladder.zsh | 159 |
examples/demos/295_soundex.zsh | 151 |
examples/demos/296_minesweeper.zsh | 187 |
examples/demos/297_mastermind.zsh | 133 |
examples/demos/298_ttt_minimax.zsh | 180 |
examples/demos/299_conway_animated.zsh | 143 |
examples/demos/29_matrix_print.zsh | 32 |
examples/demos/300_milestone_300.zsh | 108 |
examples/demos/301_url_template.zsh | 163 |
examples/demos/302_sql_mini_parser.zsh | 213 |
examples/demos/303_zsh_print_z.zsh | 89 |
examples/demos/304_zsh_unhash_pattern.zsh | 119 |
examples/demos/305_zsh_typeset_m.zsh | 118 |
examples/demos/306_zsh_zle_widgets.zsh | 137 |
examples/demos/307_zsh_compsys_args.zsh | 124 |
examples/demos/308_kruskal_algo_density.zsh | 167 |
examples/demos/309_state_machine_dsl.zsh | 154 |
examples/demos/30_pattern_match.zsh | 49 |
examples/demos/310_banner_v5.zsh | 122 |
examples/demos/311_bst.zsh | 184 |
examples/demos/312_avl_tree.zsh | 166 |
examples/demos/313_bloom_filter_v2.zsh | 161 |
examples/demos/314_deque.zsh | 172 |
examples/demos/315_ring_buffer.zsh | 156 |
examples/demos/316_ipv4_subnet.zsh | 169 |
examples/demos/317_mac_address.zsh | 174 |
examples/demos/318_file_checksum.zsh | 142 |
examples/demos/319_anagram_solver.zsh | 158 |
examples/demos/31_stack.zsh | 33 |
examples/demos/320_leet_speak.zsh | 157 |
examples/demos/321_pig_latin.zsh | 158 |
examples/demos/322_history_parser.zsh | 161 |
examples/demos/323_ssh_known_hosts.zsh | 156 |
examples/demos/324_brace_advanced.zsh | 112 |
examples/demos/325_zsh_print_more.zsh | 124 |
examples/demos/326_zsh_compinit.zsh | 130 |
examples/demos/327_zsh_extended_glob.zsh | 151 |
examples/demos/328_zsh_kv_assoc.zsh | 183 |
examples/demos/329_max_subarray.zsh | 205 |
examples/demos/32_queue.zsh | 30 |
examples/demos/330_lis_lcs.zsh | 216 |
examples/demos/331_knapsack.zsh | 173 |
examples/demos/332_coin_change.zsh | 164 |
examples/demos/333_topological_sort.zsh | 196 |
examples/demos/334_lru_cache.zsh | 179 |
examples/demos/335_banner_v6.zsh | 120 |
examples/demos/336_roman_numeral.zsh | 148 |
examples/demos/337_trie_advanced.zsh | 183 |
examples/demos/338_z_function.zsh | 146 |
examples/demos/339_longest_common_substring.zsh | 159 |
examples/demos/33_binary_search.zsh | 28 |
examples/demos/340_palindromic_subseq.zsh | 221 |
examples/demos/341_nim_game.zsh | 213 |
examples/demos/342_peg_solitaire.zsh | 204 |
examples/demos/343_rfc2822_date.zsh | 198 |
examples/demos/344_iso8601.zsh | 235 |
examples/demos/345_pollard_rho.zsh | 162 |
examples/demos/346_continued_fraction.zsh | 144 |
examples/demos/347_transposition_cipher.zsh | 220 |
examples/demos/348_color_conversions.zsh | 238 |
examples/demos/349_zsh_eval_context.zsh | 157 |
examples/demos/34_bubble_sort.zsh | 27 |
examples/demos/350_milestone_350.zsh | 105 |
examples/demos/351_sokoban_small.zsh | 197 |
examples/demos/352_text_wrap.zsh | 193 |
examples/demos/353_unicode_utils.zsh | 216 |
examples/demos/354_url_encode.zsh | 250 |
examples/demos/355_calendar_print.zsh | 191 |
examples/demos/356_disjoint_set.zsh | 249 |
examples/demos/357_priority_queue.zsh | 261 |
examples/demos/358_zsh_funcfile.zsh | 185 |
examples/demos/359_zsh_param_complete.zsh | 174 |
examples/demos/35_insertion_sort.zsh | 27 |
examples/demos/360_banner_v7.zsh | 104 |
examples/demos/361_json_parser_full.zsh | 708 |
examples/demos/362_xml_parser_full.zsh | 626 |
examples/demos/363_arith_expr_evaluator.zsh | 697 |
examples/demos/364_csv_rfc4180.zsh | 553 |
examples/demos/365_mini_lisp.zsh | 693 |
examples/demos/366_sudoku_solver_bt.zsh | 364 |
examples/demos/367_banner_v8.zsh | 115 |
examples/demos/36_selection_sort.zsh | 29 |
examples/demos/37_counting_sort.zsh | 31 |
examples/demos/38_set_ops.zsh | 43 |
examples/demos/39_matrix_multiply.zsh | 38 |
examples/demos/40_roman_numerals.zsh | 50 |
examples/demos/41_base_convert.zsh | 44 |
examples/demos/42_tower_of_hanoi.zsh | 21 |
examples/demos/43_collatz.zsh | 50 |
examples/demos/44_happy_numbers.zsh | 58 |
examples/demos/45_armstrong.zsh | 34 |
examples/demos/46_perfect_numbers.zsh | 42 |
examples/demos/47_rot13.zsh | 20 |
examples/demos/48_atbash.zsh | 20 |
examples/demos/49_word_reverse.zsh | 39 |
examples/demos/50_histogram.zsh | 46 |
examples/demos/51_csv_parse.zsh | 50 |
examples/demos/52_env_basics.zsh | 35 |
examples/demos/53_file_tests.zsh | 51 |
examples/demos/54_date_format.zsh | 34 |
examples/demos/55_read_loop.zsh | 52 |
examples/demos/56_exit_codes.zsh | 41 |
examples/demos/57_atoi_itoa.zsh | 45 |
examples/demos/58_gcd_lcm.zsh | 52 |
examples/demos/59_string_reverse_ops.zsh | 69 |
examples/demos/60_mapfile_like.zsh | 38 |
examples/demos/61_zsh_modifiers.zsh | 34 |
examples/demos/62_param_flags_match.zsh | 35 |
examples/demos/63_param_flags_join_split.zsh | 37 |
examples/demos/64_param_flags_case.zsh | 37 |
examples/demos/65_param_flags_sort.zsh | 35 |
examples/demos/66_param_flags_format.zsh | 40 |
examples/demos/67_glob_qualifiers.zsh | 48 |
examples/demos/68_extended_glob.zsh | 46 |
examples/demos/69_assoc_advanced.zsh | 66 |
examples/demos/70_array_set_ops_zsh.zsh | 57 |
examples/demos/71_array_pattern_filter.zsh | 55 |
examples/demos/72_typeset_int_base.zsh | 46 |
examples/demos/73_print_columnar.zsh | 39 |
examples/demos/74_print_prompt_escapes.zsh | 34 |
examples/demos/75_zparseopts.zsh | 51 |
examples/demos/76_mathfunc.zsh | 49 |
examples/demos/77_datetime.zsh | 48 |
examples/demos/78_setopt_local_scope.zsh | 64 |
examples/demos/79_eval_dynamic_dispatch.zsh | 62 |
examples/demos/80_anon_fn_args.zsh | 66 |
examples/demos/81_compound_defaults.zsh | 55 |
examples/demos/82_brace_advanced.zsh | 59 |
examples/demos/83_history_modifiers.zsh | 50 |
examples/demos/84_subst_split_complex.zsh | 58 |
examples/demos/85_zcalc_repl.zsh | 74 |
examples/demos/86_setopt_exhaustive.zsh | 47 |
examples/demos/87_read_advanced.zsh | 42 |
examples/demos/88_printf_format_advanced.zsh | 56 |
examples/demos/89_regex_match.zsh | 45 |
examples/demos/90_type_whence.zsh | 60 |
examples/demos/91_hash_builtin.zsh | 47 |
examples/demos/92_arithmetic_for.zsh | 62 |
examples/demos/93_nested_assoc.zsh | 80 |
examples/demos/94_case_advanced.zsh | 83 |
examples/demos/95_fd_redirection.zsh | 53 |
examples/demos/96_strict_mode.zsh | 58 |
examples/demos/97_indirection.zsh | 76 |
examples/demos/98_coreutils_builtins.zsh | 65 |
examples/demos/99_negative_indexing.zsh | 50 |
| src/zsh | |
src/zsh/Test/runtests.zsh | 28 |
src/zsh/Test/ztst.zsh | 631 |
| test_corpus | |
test_corpus/alias-finder.plugin.zsh | 47 |
test_corpus/autojump.plugin.zsh | 36 |
test_corpus/branch.plugin.zsh | 35 |
test_corpus/dirhistory.plugin.zsh | 221 |
test_corpus/docker-aliases.zsh | 195 |
test_corpus/dotenv.plugin.zsh | 64 |
test_corpus/frontend-search.plugin.zsh | 112 |
test_corpus/git-lfs.plugin.zsh | 17 |
test_corpus/grc.zsh | 38 |
test_corpus/jhipster.plugin.zsh | 130 |
test_corpus/last-working-dir.plugin.zsh | 28 |
test_corpus/macos.plugin.zsh | 268 |
test_corpus/magic-enter.plugin.zsh | 38 |
test_corpus/man.plugin.zsh | 37 |
test_corpus/per-directory-history.zsh | 174 |
test_corpus/python.plugin.zsh | 83 |
test_corpus/svn.plugin.zsh | 89 |
test_corpus/systemd.plugin.zsh | 116 |
test_corpus/terraform.plugin.zsh | 17 |
test_corpus/thefuck.plugin.zsh | 21 |
test_corpus/xcode.plugin.zsh | 201 |
test_corpus/zpwr-syntax.zsh | 184 |
test_corpus/zpwr-verbs.zsh | 477 |
test_corpus/zpwr256ColorTest.zsh | 19 |
test_corpus/zsh-autocomplete.plugin.zsh | 35 |
test_corpus/zsh-cpan-completion.plugin.zsh | 79 |
test_corpus/zsh-z.plugin.zsh | 698 |
test_corpus/ztst.zsh | 631 |
| tests/lexer_corpus | |
tests/lexer_corpus/08_grc.zsh | 38 |
tests/lexer_corpus/09_delete_dups.zsh | 21 |
tests/lexer_corpus/10_zpwr-hash-dirs.zsh | 19 |
tests/lexer_corpus/11_keybindings.zsh | 71 |
tests/lexer_corpus/16_nested_cmdsubst.zsh | 4 |
tests/lexer_corpus/17_heredocs.zsh | 3 |
tests/lexer_corpus/18_param_expansion.zsh | 19 |
tests/lexer_corpus/19_glob_qualifiers.zsh | 10 |
tests/lexer_corpus/20_procsubst.zsh | 4 |
tests/lexer_corpus/21_dbrack_cond.zsh | 10 |
tests/lexer_corpus/22_brace_expand.zsh | 7 |
tests/lexer_corpus/23_arrays.zsh | 15 |
tests/lexer_corpus/24_for_cstyle.zsh | 11 |
tests/lexer_corpus/25_select_coproc_time.zsh | 16 |
tests/lexer_corpus/26_quotes_mixed.zsh | 9 |
tests/lexer_corpus/27_zinit_ice.zsh | 8 |
tests/lexer_corpus/28_zsh_globs.zsh | 8 |
tests/lexer_corpus/29_redirs_complex.zsh | 12 |
tests/lexer_corpus/30_arith_complex.zsh | 13 |
tests/lexer_corpus/31_nested_param_brack.zsh | 8 |
tests/lexer_corpus/32_backticks_intick.zsh | 6 |
tests/lexer_corpus/33_pattern_context.zsh | 9 |
tests/lexer_corpus/34_typeset_options.zsh | 14 |
tests/lexer_corpus/35_complex_quoting.zsh | 12 |
tests/lexer_corpus/36_empty_paren.zsh | 14 |
tests/lexer_corpus/37_continuation.zsh | 13 |
tests/lexer_corpus/38_zsh_special_params.zsh | 18 |
tests/lexer_corpus/39_omz_functions.zsh | 284 |
tests/lexer_corpus/40_zinit_additional.zsh | 219 |
tests/lexer_corpus/41_omz_git.zsh | 367 |
tests/lexer_corpus/42_zinit_side.zsh | 397 |
tests/lexer_corpus/43_zpwr_test_batch18.zsh | 209 |
tests/lexer_corpus/44_lexer_niche.zsh | 13 |
| tests/parity_corpus | |
tests/parity_corpus/01_simple_echo.zsh | 1 |
tests/parity_corpus/02_pipe_two.zsh | 1 |
tests/parity_corpus/03_assign_prefix.zsh | 1 |
tests/parity_corpus/04_andand.zsh | 1 |
tests/parity_corpus/05_subsh.zsh | 1 |
tests/parity_corpus/06_for_in.zsh | 3 |
tests/parity_corpus/07_if_simple.zsh | 3 |
tests/parity_corpus/08_funcdef.zsh | 3 |
tests/parity_corpus/09_case_multi.zsh | 4 |
tests/parity_corpus/100_glob_qualifiers.zsh | 13 |
tests/parity_corpus/101_case_select.zsh | 8 |
tests/parity_corpus/102_math_complex.zsh | 4 |
tests/parity_corpus/103_param_complex.zsh | 4 |
tests/parity_corpus/104_if_multi_elif.zsh | 10 |
tests/parity_corpus/105_case_complex.zsh | 5 |
tests/parity_corpus/106_array_index.zsh | 5 |
tests/parity_corpus/107_cond_not.zsh | 3 |
tests/parity_corpus/108_time_block.zsh | 3 |
tests/parity_corpus/109_if_multi_cond.zsh | 4 |
tests/parity_corpus/10_cond_unary.zsh | 3 |
tests/parity_corpus/110_while_multi_cond.zsh | 4 |
tests/parity_corpus/111_case_empty.zsh | 2 |
tests/parity_corpus/112_array_empty.zsh | 2 |
tests/parity_corpus/113_param_double_colon.zsh | 4 |
tests/parity_corpus/114_case_nested.zsh | 7 |
tests/parity_corpus/115_param_padding.zsh | 3 |
tests/parity_corpus/116_proc_subst_eq.zsh | 1 |
tests/parity_corpus/117_time_pipeline.zsh | 2 |
tests/parity_corpus/118_param_exp_multi.zsh | 4 |
tests/parity_corpus/119_not_blocks.zsh | 3 |
tests/parity_corpus/11_arith.zsh | 1 |
tests/parity_corpus/120_param_special.zsh | 8 |
tests/parity_corpus/121_math_ternary.zsh | 2 |
tests/parity_corpus/122_case_multi_pat.zsh | 6 |
tests/parity_corpus/123_cond_misc.zsh | 4 |
tests/parity_corpus/123_glob_qualifiers_more.zsh | 7 |
tests/parity_corpus/124_math_bitwise_complex.zsh | 3 |
tests/parity_corpus/125_param_defined.zsh | 5 |
tests/parity_corpus/126_func_shift.zsh | 6 |
tests/parity_corpus/127_redir_more.zsh | 8 |
tests/parity_corpus/128_math_ternary_complex.zsh | 2 |
tests/parity_corpus/129_cmdsubst_nested.zsh | 3 |
tests/parity_corpus/12_while.zsh | 4 |
tests/parity_corpus/130_cond_logic.zsh | 3 |
tests/parity_corpus/131_math_deep.zsh | 2 |
tests/parity_corpus/132_pipe_multi.zsh | 2 |
tests/parity_corpus/133_not_pipe_complex.zsh | 3 |
tests/parity_corpus/134_brace_seq_step.zsh | 4 |
tests/parity_corpus/135_cond_regex_complex.zsh | 2 |
tests/parity_corpus/136_param_flags_final_v2.zsh | 7 |
tests/parity_corpus/137_param_modifiers.zsh | 11 |
tests/parity_corpus/138_math_ternary_nested.zsh | 3 |
tests/parity_corpus/139_herestring_variations.zsh | 4 |
tests/parity_corpus/13_redir_dup.zsh | 1 |
tests/parity_corpus/14_while.zsh | 5 |
tests/parity_corpus/15_repeat.zsh | 1 |
tests/parity_corpus/16_try_always.zsh | 5 |
tests/parity_corpus/17_cond_binary.zsh | 3 |
tests/parity_corpus/21_select.zsh | 4 |
tests/parity_corpus/22_arith_complex.zsh | 3 |
tests/parity_corpus/23_param_expansion.zsh | 4 |
tests/parity_corpus/25_coproc.zsh | 2 |
tests/parity_corpus/26_time.zsh | 2 |
tests/parity_corpus/27_case_terms.zsh | 5 |
tests/parity_corpus/28_for_positional.zsh | 3 |
tests/parity_corpus/29_nested_blocks.zsh | 2 |
tests/parity_corpus/30_cond_complex.zsh | 3 |
tests/parity_corpus/31_if_complex.zsh | 7 |
tests/parity_corpus/32_for_cstyle.zsh | 3 |
tests/parity_corpus/33_redir_var.zsh | 3 |
tests/parity_corpus/34_herestring.zsh | 2 |
tests/parity_corpus/35_array_assign.zsh | 4 |
tests/parity_corpus/36_brace_expand.zsh | 3 |
tests/parity_corpus/37_proc_subst.zsh | 2 |
tests/parity_corpus/41_nested_loops.zsh | 5 |
tests/parity_corpus/45_herestring_complex.zsh | 2 |
tests/parity_corpus/46_case_glob.zsh | 5 |
tests/parity_corpus/47_func_keyword.zsh | 6 |
tests/parity_corpus/48_param_split_f.zsh | 4 |
tests/parity_corpus/49_param_flags_basic.zsh | 3 |
tests/parity_corpus/50_param_substring.zsh | 2 |
tests/parity_corpus/51_param_subst.zsh | 4 |
tests/parity_corpus/52_param_nested.zsh | 3 |
tests/parity_corpus/53_param_cmdsubst.zsh | 2 |
tests/parity_corpus/54_logical.zsh | 2 |
tests/parity_corpus/55_negation.zsh | 3 |
tests/parity_corpus/56_cond_file.zsh | 5 |
tests/parity_corpus/57_cond_binary_files.zsh | 3 |
tests/parity_corpus/58_cond_numeric.zsh | 6 |
tests/parity_corpus/59_case_patterns.zsh | 6 |
tests/parity_corpus/60_backticks.zsh | 2 |
tests/parity_corpus/61_logical_complex.zsh | 1 |
tests/parity_corpus/62_param_length.zsh | 3 |
tests/parity_corpus/63_param_default.zsh | 8 |
tests/parity_corpus/64_param_remove.zsh | 4 |
tests/parity_corpus/65_alias.zsh | 2 |
tests/parity_corpus/66_param_flags_advanced.zsh | 8 |
tests/parity_corpus/67_redir_force.zsh | 5 |
tests/parity_corpus/68_multios.zsh | 3 |
tests/parity_corpus/69_cmdsubst.zsh | 4 |
tests/parity_corpus/70_param_pattern.zsh | 7 |
tests/parity_corpus/71_background.zsh | 3 |
tests/parity_corpus/73_brace_basic.zsh | 3 |
tests/parity_corpus/74_math_ops.zsh | 9 |
tests/parity_corpus/75_cond_file_more.zsh | 10 |
tests/parity_corpus/77_cmd_modifiers.zsh | 3 |
tests/parity_corpus/78_param_flags_extra.zsh | 8 |
tests/parity_corpus/79_math_inc_dec.zsh | 4 |
tests/parity_corpus/80_math_assign.zsh | 10 |
tests/parity_corpus/81_nested_complex.zsh | 3 |
tests/parity_corpus/82_brace_seq.zsh | 2 |
tests/parity_corpus/83_math_comma.zsh | 1 |
tests/parity_corpus/84_math_ops_more.zsh | 2 |
tests/parity_corpus/85_cond_string_eq.zsh | 3 |
tests/parity_corpus/86_empty_bodies.zsh | 2 |
tests/parity_corpus/87_param_offset_negative.zsh | 2 |
tests/parity_corpus/88_cond_regex_simple.zsh | 1 |
tests/parity_corpus/89_param_flags_count.zsh | 2 |
tests/parity_corpus/90_param_flags_final.zsh | 5 |
tests/parity_corpus/91_math_bitwise.zsh | 4 |
tests/parity_corpus/92_nested_if.zsh | 5 |
tests/parity_corpus/93_case_empty_arm.zsh | 4 |
tests/parity_corpus/94_param_flags_D.zsh | 1 |
tests/parity_corpus/95_math_precedence.zsh | 2 |
tests/parity_corpus/96_redir_fd_complex.zsh | 4 |
tests/parity_corpus/97_expand_nesting_more.zsh | 3 |
tests/parity_corpus/98_brace_comma_empty.zsh | 3 |
tests/parity_corpus/99_param_flags_q_extra.zsh | 2 |
| tests/recorder_corpus | |
tests/recorder_corpus/01_aliases_basic.zsh | 6 |
tests/recorder_corpus/02_alias_redefine.zsh | 5 |
tests/recorder_corpus/03_alias_variants.zsh | 5 |
tests/recorder_corpus/04_exports.zsh | 5 |
tests/recorder_corpus/05_assigns.zsh | 5 |
tests/recorder_corpus/06_setopts.zsh | 6 |
tests/recorder_corpus/07_zstyle.zsh | 4 |
tests/recorder_corpus/08_bindkey.zsh | 6 |
tests/recorder_corpus/09_hash_d.zsh | 6 |
tests/recorder_corpus/10_traps.zsh | 4 |
tests/recorder_corpus/11_zmodload.zsh | 4 |
tests/recorder_corpus/12_functions.zsh | 10 |
tests/recorder_corpus/13_kitchen_sink.zsh | 15 |
tests/recorder_corpus/14_conditional.zsh | 9 |
tests/recorder_corpus/15_listing_only.zsh | 14 |
tests/recorder_corpus/16_typeset_family.zsh | 11 |
tests/recorder_corpus/17_autoload.zsh | 8 |
tests/recorder_corpus/18_set_o_form.zsh | 8 |
tests/recorder_corpus/19_unalias_unset.zsh | 13 |
tests/recorder_corpus/20_function_forms.zsh | 27 |
tests/recorder_corpus/21_assignment_forms.zsh | 35 |
tests/recorder_corpus/22_zle_widgets.zsh | 14 |
tests/recorder_corpus/23_completions_discover.zsh | 7 |
tests/recorder_corpus/24_replay_types.zsh | 37 |
tests/recorder_corpus/zinit/git-process-output.zsh | 186 |
tests/recorder_corpus/zinit/zinit-additional.zsh | 219 |
tests/recorder_corpus/zinit/zinit-autoload.zsh | 3,616 |
tests/recorder_corpus/zinit/zinit-install.zsh | 2,451 |
tests/recorder_corpus/zinit/zinit-side.zsh | 397 |
tests/recorder_corpus/zinit/zinit.zsh | 3,351 |
tests/recorder_corpus/zshrc/.zpwr/local/zpwr-hash-dirs.zsh | 19 |
tests/recorder_corpus/zshrc/zshrc.zsh | 889 |
Embedded example scripts (top 10 by LOC)
Full source of the largest corpus scripts. Each is collapsed by default; sources beyond 800 lines are truncated with a count of trailing lines.
[0x09c] GRAMMAR & SYNTAX — CANONICAL TABLES
Every reserved keyword, builtin, setopt option, special variable,
parameter flag, glob qualifier, operator, history expansion, and word modifier
recognized by zshrs. Sourced directly from upstream zsh C tables
(Src/hashtable.c::reswds[], Src/builtin.c::builtins[],
Src/Modules/*.c, Src/options.c::optns[],
Src/params.c::special_params[]) plus the zshrs extension
builtins in daemon/builtins.rs + src/extensions/.
Single source of truth lives at data/grammar/canonical.json;
regenerate this section via python3 scripts/gen_grammar_docs.py.
Generated 2026-05-31 from data/grammar/canonical.json.
Reserved keywords (50)
Control flow (20)
[[
]]
always
case
do
done
elif
else
end
esac
fi
for
foreach
if
in
repeat
select
then
until
while
Declaration (10)
declare
export
float
integer
let
local
readonly
set
shift
typeset
Function (1)
function
Grouping (2)
{
}
I/O / source (5)
.
eval
exec
source
trap
Loop control (5)
break
continue
exit
logout
return
Modifier (precommand) (6)
builtin
command
coproc
nocorrect
noglob
time
Operator-like (1)
!
Builtins (157)
POSIX / zsh core (74)
.
:
[
alias
autoload
bg
break
bye
cd
chdir
continue
declare
dirs
disable
disown
echo
emulate
enable
eval
exit
export
false
fc
fg
float
functions
getln
getopts
hash
hashinfo
history
integer
jobs
kill
let
local
logout
mem
patdebug
popd
print
printf
pushd
pushln
pwd
r
read
readonly
rehash
return
set
setopt
shift
source
suspend
test
times
trap
true
ttyctl
type
typeset
umask
unalias
unfunction
unhash
unset
unsetopt
wait
whence
where
which
zcompile
zmodload
zsh modules (59)
cap
chgrp
chmod
chown
clone
echotc
echoti
example
getcap
ln
local
log
mkdir
mv
nameref
pcre_compile
pcre_match
pcre_study
private
rm
rmdir
setcap
stat
strftime
sync
syserror
sysopen
sysread
sysseek
syswrite
zcurses
zdelattr
zf_chgrp
zf_chmod
zf_chown
zf_ln
zf_mkdir
zf_mv
zf_rm
zf_rmdir
zf_sync
zformat
zftp
zgdbmpath
zgetattr
zlistattr
zparseopts
zprof
zpty
zregexparse
zselect
zsetattr
zsocket
zstat
zstyle
zsystem
ztcp
ztie
zuntie
zshrs extensions (24)
zask
zcache
zcompdump
zcomplete
zd
zhistory
zid
zjob
zlock
zlog
zls
znotify
zping
zpublish
zsend
zsource
zsubscribe
zsuggest
zsync
ztag
zunsubscribe
zuntag
zwc
zwhere
setopt options (196)
ALIASES
ALIASFUNCDEF
ALLEXPORT
ALWAYSLASTPROMPT
ALWAYSTOEND
APPENDCREATE
APPENDHISTORY
AUTOCD
AUTOCONTINUE
AUTOLIST
AUTOMENU
AUTONAMEDIRS
AUTOPARAMKEYS
AUTOPARAMSLASH
AUTOPUSHD
AUTOREMOVESLASH
AUTORESUME
BADPATTERN
BANGHIST
BAREGLOBQUAL
BASHAUTOLIST
BASHREMATCH
BEEP
BGNICE
BRACECCL
BRACEEXPAND
BSDECHO
CASEGLOB
CASEMATCH
CASEPATHS
CBASES
CDABLEVARS
CDSILENT
CHASEDOTS
CHASELINKS
CHECKJOBS
CHECKRUNNINGJOBS
CLOBBER
CLOBBEREMPTY
COMBININGCHARS
COMPLETEALIASES
COMPLETEINWORD
CONTINUEONERROR
CORRECT
CORRECTALL
CPRECEDENCES
CSHJUNKIEHISTORY
CSHJUNKIELOOPS
CSHJUNKIEQUOTES
CSHNULLCMD
CSHNULLGLOB
DEBUGBEFORECMD
DOTGLOB
DVORAK
EMACS
EQUALS
ERREXIT
ERRRETURN
EVALLINENO
EXEC
EXTENDEDGLOB
EXTENDEDHISTORY
FLOWCONTROL
FORCEFLOAT
FUNCTIONARGZERO
GLOB
GLOBALEXPORT
GLOBALRCS
GLOBASSIGN
GLOBCOMPLETE
GLOBDOTS
GLOBSTARSHORT
GLOBSUBST
HASHALL
HASHCMDS
HASHDIRS
HASHEXECUTABLESONLY
HASHLISTALL
HISTALLOWCLOBBER
HISTAPPEND
HISTBEEP
HISTEXPAND
HISTEXPIREDUPSFIRST
HISTFCNTLLOCK
HISTFINDNODUPS
HISTIGNOREALLDUPS
HISTIGNOREDUPS
HISTIGNORESPACE
HISTLEXWORDS
HISTNOFUNCTIONS
HISTNOSTORE
HISTREDUCEBLANKS
HISTSAVEBYCOPY
HISTSAVENODUPS
HISTSUBSTPATTERN
HISTVERIFY
HUP
IGNOREBRACES
IGNORECLOSEBRACES
IGNOREEOF
INCAPPENDHISTORY
INCAPPENDHISTORYTIME
INTERACTIVE
INTERACTIVECOMMENTS
KSHARRAYS
KSHAUTOLOAD
KSHGLOB
KSHOPTIONPRINT
KSHTYPESET
KSHZEROSUBSCRIPT
LISTAMBIGUOUS
LISTBEEP
LISTPACKED
LISTROWSFIRST
LISTTYPES
LOCALLOOPS
LOCALOPTIONS
LOCALPATTERNS
LOCALTRAPS
LOG
LOGIN
LONGLISTJOBS
MAGICEQUALSUBST
MAILWARN
MAILWARNING
MARKDIRS
MENUCOMPLETE
MONITOR
MULTIBYTE
MULTIFUNCDEF
MULTIOS
NOMATCH
NOTIFY
NULLGLOB
NUMERICGLOBSORT
OCTALZEROES
ONECMD
OVERSTRIKE
PATHDIRS
PATHSCRIPT
PHYSICAL
PIPEFAIL
POSIXALIASES
POSIXARGZERO
POSIXBUILTINS
POSIXCD
POSIXIDENTIFIERS
POSIXJOBS
POSIXSTRINGS
POSIXTRAPS
PRINTEIGHTBIT
PRINTEXITVALUE
PRIVILEGED
PROMPTBANG
PROMPTCR
PROMPTPERCENT
PROMPTSP
PROMPTSUBST
PROMPTVARS
PUSHDIGNOREDUPS
PUSHDMINUS
PUSHDSILENT
PUSHDTOHOME
RCEXPANDPARAM
RCQUOTES
RCS
RECEXACT
REMATCHPCRE
RMSTARSILENT
RMSTARWAIT
SHAREHISTORY
SHFILEEXPANSION
SHGLOB
SHINSTDIN
SHNULLCMD
SHOPTIONLETTERS
SHORTLOOPS
SHORTREPEAT
SHWORDSPLIT
SINGLECOMMAND
SINGLELINEZLE
SOURCETRACE
STDIN
SUNKEYBOARDHACK
TRACKALL
TRANSIENTRPROMPT
TRAPSASYNC
TYPESETSILENT
TYPESETTOUNSET
UNSET
VERBOSE
VI
WARNCREATEGLOBAL
WARNNESTEDVAR
XTRACE
ZLE
Special variables (88)
$!
$#
$$
$*
$-
$0
$?
$@
$ARGC
$CDPATH
$COLUMNS
$EGID
$ERRNO
$EUID
$FIGNORE
$FPATH
$FUNCNEST
$GID
$HISTCHARS
$HISTCMD
$HISTSIZE
$HOME
$IFS
$KEYBOARD_HACK
$LANG
$LC_ALL
$LC_COLLATE
$LC_CTYPE
$LC_MESSAGES
$LC_NUMERIC
$LC_TIME
$LINENO
$LINES
$MAILPATH
$MANPATH
$MODULE_PATH
$NULLCMD
$OPTARG
$OPTIND
$PATH
$POSTEDIT
$PPID
$PROMPT
$PROMPT2
$PROMPT3
$PROMPT4
$PS1
$PS2
$PS3
$PS4
$PSVAR
$RANDOM
$READNULLCMD
$RPROMPT
$RPROMPT2
$RPS1
$RPS2
$SAVEHIST
$SECONDS
$SHLVL
$SPROMPT
$TERM
$TERMINFO
$TERMINFO_DIRS
$TRY_BLOCK_ERROR
$TRY_BLOCK_INTERRUPT
$TTYIDLE
$UID
$USERNAME
$WORDCHARS
$ZLE_RPROMPT_INDENT
$ZSH_EVAL_CONTEXT
$ZSH_SUBSHELL
$_
$argv
$cdpath
$fignore
$fpath
$histchars
$mailpath
$manpath
$module_path
$path
$pipestatus
$prompt
$psvar
$status
$zsh_eval_context
Parameter expansion flags (38)
| Flag | Meaning |
|---|---|
${(@)var} | array-context retain $@ semantics; quoting-preserving even in scalar context |
${(A)var} | create as an array |
${(a)var} | sort by array index |
${(c)var} | count words in a parameter (e.g., scalar split count) |
${(C)var} | capitalize words |
${(D)var} | treat as DIRECTORY name (apply directory substitution like ~/...) |
${(e)var} | perform parameter expansion / arithmetic / etc. on the result |
${(f)var} | split result at newlines |
${(F)var} | join array elements with newlines |
${(g)var} | process escape sequences like print does (g:o: process octals, g:c: process \c) |
${(i)var} | case-insensitive sort |
${(j)var} | join array with separator: ${(j:sep:)arr} |
${(k)var} | for assoc arrays: keys ${(k)hash} |
${(K)var} | subscript flags: use keys |
${(L)var} | lowercase |
${(M)var} | match: use longest match (also for case-insensitivity in sort) |
${(n)var} | numeric sort |
${(o)var} | sort ascending |
${(O)var} | sort descending |
${(p)var} | interpret embedded escape sequences in j/s separator |
${(P)var} | treat value as parameter name → indirect (P) |
${(q)var} | quote the result (q-/q+/qq/qqq variants for shell-quote levels) |
${(Q)var} | remove quoting |
${(r)var} | right-justify within field width: ${(r:N::pad:)var} |
${(l)var} | left-justify within field width: ${(l:N::pad:)var} |
${(s)var} | split at separator: ${(s:sep:)var} |
${(S)var} | subscript: search subscript ranges |
${(t)var} | test parameter type |
${(u)var} | unique (dedupe array) |
${(U)var} | uppercase |
${(v)var} | for assoc arrays: values ${(v)hash} |
${(V)var} | make invisible / control chars visible |
${(w)var} | split into words |
${(W)var} | split into words (alternate) |
${(z)var} | split as the shell would (z-tokens) |
${(#)var} | expand result as arithmetic; numeric value |
${(%)var} | expand prompt percent escapes in result |
${(~)var} | treat values as patterns (e.g., for /pat/repl) |
Glob qualifiers (44)
| Qual | Meaning |
|---|---|
*(/) | directories only |
*(.) | regular files only |
*(@) | symbolic links only |
*(=) | sockets only |
*(p) | named pipes (FIFOs) only |
*(*) | executable plain files only |
*(%) | device special files only |
*(%b) | block special files |
*(%c) | character special files |
*(r) | owner-readable |
*(w) | owner-writable |
*(x) | owner-executable |
*(A) | group-readable |
*(I) | group-writable |
*(E) | group-executable |
*(R) | world-readable |
*(W) | world-writable |
*(X) | world-executable |
*(s) | setuid (S_ISUID) |
*(S) | setgid (S_ISGID) |
*(t) | sticky bit |
*(d N) | device number N |
*(l[+-=]N) | exactly / less-than / greater-than N hard links |
*(U) | owned by EUID |
*(G) | owned by EGID |
*(u N) | owned by uid N |
*(g N) | group gid N |
*(f spec) | permission mask: f:o+w: e.g. |
*(L [+-=] N) | size: blocks / k / m / p suffix (Lk / Lm / Lp) |
*(a [Mwhms] [+-=] N) | access time |
*(m [Mwhms] [+-=] N) | modify time |
*(c [Mwhms] [+-=] N) | ctime |
*(o [name|size|links|mtime|atime|ctime]) | sort ascending |
*(O [name|size|links|mtime|atime|ctime]) | sort descending |
*([N,M]) | select range of matches |
*(e:str:) | external test: each match passed to expression |
*(+func) | external test: each match passed to function |
*(N) | nullglob: silently drop unmatched pattern |
*(D) | include dotfiles |
*(Y N) | limit to N results |
*(M) | include directory names as if trailing slash |
*(:mod) | apply history modifier (e.g., :t :h :r :e) |
*(^) | negate the qualifier list |
*(,) | OR-combine qualifier groups |
Operators / redirections / substitution forms (55)
| Symbol | Kind | Meaning |
|---|---|---|
| | pipeline | Pipeline. stdout of LHS → stdin of RHS. |
|& | pipeline | Pipeline with stderr merged (= |2>&1). |
&& | list | Logical AND: run RHS only if LHS exit==0. |
|| | list | Logical OR: run RHS only if LHS exit!=0. |
; | list | Sequence: run RHS after LHS regardless of status. |
& | list | Background: run LHS async; sets $!. |
;; | case | End case arm. |
;;& | case | Fall through and test next case pattern. |
;| | case | Fall through without test. |
! | neg | Negate exit status (reserved word). |
> | redirect | Stdout redirect (overwrite). |
>> | redirect | Stdout append. |
< | redirect | Stdin redirect. |
<< | redirect | Heredoc; body terminated by marker. |
<<- | redirect | Heredoc, strip leading tabs from body. |
<<< | redirect | Here-string; literal text as stdin. |
>| | redirect | Stdout force-overwrite (bypass NO_CLOBBER). |
>! | redirect | Same as >|; force-overwrite. |
&> | redirect | Redirect both stdout and stderr (bash-compat). |
&>> | redirect | Append both stdout and stderr. |
2>&1 | redirect | Duplicate fd2 to fd1 (stderr → stdout). |
>&- | redirect | Close fd. |
<> | redirect | Open for read+write. |
<( | procsub | Process substitution: <(cmd) is a path readable from cmd's stdout. |
>( | procsub | Process substitution: >(cmd) is a path writable into cmd's stdin. |
=( | procsub | Zsh-only =(cmd): tempfile capture. |
$( | subst | Command substitution: $(cmd) captures cmd's stdout. |
${ | subst | Parameter expansion: ${var}. |
$(( | subst | Arithmetic expansion: $((expr)). |
(( | arith | Arithmetic command. ((expr)) exits 0 iff expr != 0. |
)) | arith | Close arithmetic command. |
[[ | cond | Open conditional command: [[ expr ]]. |
]] | cond | Close conditional command. |
= | assign | Assignment. Also: equality in [[ ]]. |
+= | assign | Append assignment (scalar concat / array push). |
-= | assign | Numeric subtract-assign (in (( ))). |
:= | assign | ${var:=default}: assign default if unset/empty. |
?= | assign | (arith) ternary. |
== | compare | Equality in (( )) / [[ ]]. |
!= | compare | Inequality. |
=~ | compare | Regex match in [[ ]] (POSIX ERE / PCRE depending on opts). |
* | glob | Glob: match any sequence (including empty). |
** | glob | Recursive glob (matches dir/subdir/.../ levels). |
? | glob | Glob: match one character. |
~ | tilde | Tilde expansion: ~ → $HOME, ~user, ~+ / ~- / ~N for dirstack. |
{a,b,c} | brace | Brace expansion: comma-separated list. |
{1..10} | brace | Brace expansion: numeric range. |
{a..z} | brace | Brace expansion: character range. |
${~var} | expansion | Treat result of var as pattern. |
${^var} | expansion | Array element rcexpansion. |
${=var} | expansion | Word-split on IFS. |
$'…' | string | ANSI-C quoted string: \n \t \xNN etc. |
$"…" | string | Locale-translated string. |
`…` | subst | Backtick command substitution (legacy form of $()). |
@{} | extension | Zshrs @-prefix: dispatch to stryke embedded scripting. |
History expansions (10)
| Form | Meaning |
|---|---|
!! | previous command |
!N | command N in history |
!-N | command N back |
!?str | most recent containing str |
!str | most recent starting with str |
!$ | last word of previous command |
!^ | first arg of previous command |
!* | all args of previous command |
!:N | Nth word of previous command |
^old^new | quick substitute in previous command |
Word modifiers (16)
| Modifier | Meaning |
|---|---|
:h | head: dirname of path |
:t | tail: basename of path |
:r | root: strip extension |
:e | extension: keep only extension |
:l | lowercase |
:u | uppercase |
:q | quote for shell re-input |
:Q | remove quoting |
:s/old/new/ | substitute first match |
:gs/old/new/ | global substitute |
:a | absolutize (resolve relative path) |
:A | absolutize and resolve symlinks |
:P | physical resolved path |
:x | split into words on whitespace |
:w | select words |
:F | follow symlinks (in conjunction with above) |
[0xFF] THE PHILOSOPHY
Shells haven't fundamentally improved since the 1990s. bash is a GNU rewrite of the Bourne shell from 1979. zsh added features but kept the fork-based C architecture. fish focused on UX and abandoned POSIX. nushell reinvented the data model but lost compatibility.
zshrs takes a different approach: keep everything that makes zsh powerful —
glob qualifiers, parameter expansion flags, the completion system, ZLE, zstyle, modules —
and replace the runtime with modern systems engineering. Rust instead of C. Thread pool
instead of fork. rkyv mmap'd zero-copy archives instead of flat files. Bytecode VM
instead of tree-walker. AOP instead of monkey-patching.
The result is the first shell that gets faster as you add more plugins,
because the plugin cache means each plugin is only parsed once. The first shell where
**/*.rs scales with your CPU count. The first shell where you can
intercept any command with nanosecond-accurate timing and zero overhead.
The result is the first shell where every command — interactive or scripted —
compiles to bytecodes and executes on a VM with fused superinstructions. The first
shell where autoload functions load from pre-compiled bytecodes in microseconds. The first
shell where source ~/.zshrc can skip the lexer, parser, and compiler entirely
because the bytecodes are mmap'd zero-copy from rkyv archives the daemon
already validated.
Since the Bourne shell at Bell Labs in 1970, through csh, ksh, bash, zsh, and fish — every Unix shell has been an interpreter. zshrs is the first to be a compiler. Shell scripts at machine code speed. Achieved in alpha.
THE FIRST COMPILED UNIX SHELL. THE MOST POWERFUL SHELL EVER CREATED.