Implementing a zsh shell from scratch in Odin.
AI has NOT been used to implement any piece of this code. AI has been used only to review the codebase. All implementation, architecture, design, debugging, etc... has been done by a human.
echo,type,pwd,cd,exit,history
- External program execution via
PATHlookup - Process forking with
fork/execvp - Exit code tracking (
$?semantics)
- Single and double quote handling with escape sequences
- Backslash escaping outside quotes
- Semicolon (
;) command chaining - Brace parsing with error detection
- Stdout redirection (
>,>>,1>,1>>) - Stderr redirection (
2>,2>>) - Stdin redirection (
<)
- Multi-command pipelines (
cmd1 | cmd2 | cmd3) - Proper pipe fd management and per-stage forking
- Exit code from last pipeline stage (zsh semantics)
- Tilde expansion (
~,~/path,~user) - Brace expansion — comma lists (
{a,b,c}) - Brace expansion — numeric ranges (
{1..10},{01..05},{1..10..2}) - Brace expansion — alphabetic ranges (
{a..z}) - Nested brace expansion
- Command name completion (builtins +
PATHexecutables) - File and directory path completion
- Longest common prefix completion
- Double-tab to list all matches
- Arrow key (up/down) history navigation
HISTFILEpersistence (load on start, append on exit)historybuiltin with-w,-a,-rflagshistory Nto show last N entries
- Raw mode input (char-by-char via termios)
- Termios restore on exit
- Glob expansion (
*,?,**) - Environment variable expansion (
$VAR,${VAR}) &&and||operators- Job control (
&,fg,bg,jobs) - Signal handling (
SIGINT,SIGTSTP) - Aliases and functions
- Prompt customization