Slash
A Unix shell with structured commands, composable pipelines, and first-class jobs — one grammar, end to end.

Slash is a Unix shell built around a three-stage execution model: Shape (parsed structure) → Program (lowered executable semantics, immutable) → Job (runtime instance with process group, pids, state, result). The same grammar drives parsing, syntax highlighting, completion, and editor behavior. There is no second tokenizer, no regex highlighting hack, no separate configuration language.
Slash chooses correctness over POSIX compatibility in the places shells have historically lied:
pipefailis on by default, no surface syntax to disable- Variables are scalars or lists; no implicit word-splitting
argvis never flattened to a shell string; expansion happens exactly once per wordJobstate transitions monotonically:pending → running → {stopped ↔ running}* → done
What ships today
- Real Unix shell. Process groups, terminal ownership, signal discipline, pipe hygiene, reaping — all CHECKLIST-verified.
- Fish-class interactive UX. Syntax highlighting as you type,
history autosuggestions (dim ghost text), intelligent Tab
completion, smart prefix-aware Up/Down navigation,
reverse-i-search via Ctrl-R, rich prompts (any zsh
PROMPTworks), mid-prompt[N] Donenotifications (opt-in via$SLASH_NOTIFY=immediate). keybuiltin for user-configurable keybindings, with layout-aware Option-key handling on macOS —key Option-L "ls -la\n"works on any Mac out of the box, no terminal config flips required.timekeyword for honest wall + user + sys timing of any pipeline, block, or control-flow construct.- Structured introspection.
slash --dump-sexp,--dump-shape,--dump-programgive you the parse, typed-shape, and lowered-program forms of any source. Every diagnostic carries a stable code (SHxxxx/LWxxxx/EVxxxx/EXxxxx/JBxxxx).
Install
Slash requires Zig 0.16.0.
git clone https://github.com/shreeve/slash
cd slash
zig build -Doptimize=ReleaseFast
./bin/slash --version
The bin/slash binary is self-contained — no runtime dependencies
beyond libc and a TTY. Copy it anywhere on your $PATH.
Quick start
# Run interactively (in slash)
./bin/slash
# One-liner
./bin/slash -c 'echo hello, world'
# Run a script
./bin/slash my-script.sh arg1 arg2
Drop the .slashrc.example
template at ~/.slashrc and uncomment the recipes you want:
# Prompt
export PROMPT='%F{#ecede8}%K{#43669d}%D{%H:%M:%S} %F{#43669d}%K{#81a1c7}%F{#ecede8} %n@%m %F{#81a1c7}%K{}%F{#ecede8}%k %~> %f'
# Editor-time abbreviations
str ll { ls -la }
str gst { git status }
# Key bindings
key Esc-L "ls -la\n"
key Esc-G "git status\n"
Documentation
The full design lives in markdown in the repo:
- README — high-level overview and current capabilities
- PLAN —
the design constitution. The §14 test (“does this improve
Commandclarity,Pipelinecorrectness,Programcomposability, orJobcontrol?”) is the rule every feature has to pass. - CHECKLIST — line-by-line operational-correctness audit (POSIX + APUE + Harvard CS61). 77/77 boxes checked.
- VALIDATION — empirical log of interactive correctness runs against real software (vim, less, top, ssh, nested shells, Python/node REPLs).
A man slash page lives at
docs/slash.1
in the repo. Install it manually with:
sudo install -m 644 docs/slash.1 /usr/local/share/man/man1/
Tests
166 tests covering parse, lower, runtime, builtins, signal/job discipline, and interactive editor behavior:
zig build test
CI runs on Linux + macOS for every push; status badge at the
top of this page reflects the latest main.
Credits
The interactive line editor is
zigline — a separate
project that grew alongside slash to provide the primitives a
modern shell needs: hint hooks, transient input mode, mid-prompt
printAbove, and the keymap layer slash extends.