This project is a small POSIX shell implementation that is intentionally Unix/Linux-focused.
src/main.cinitializes aShellContextand loads history from$HISTFILE.shell_repl_run()(insrc/repl/repl.c) drives the REPL loop:- prints the prompt
- reads a line with raw-mode editing (
src/line_edit/line_edit.c) - stores the line in history (
src/history/history.c) - tokenizes/parses into a pipeline (
src/tokenizer/tokenizer.c,src/parser/parser.c) - executes builtins or external programs (
src/builtins/builtins.c,src/exec/exec.c)
Owns the interactive loop and glues modules together.
Implements a minimal readline-like UX using termios:
- character echo
- backspace
- up/down history navigation
- tab completion integration
Owns:
- in-memory history list
- printing (with numeric indices)
- persistence: load/save/append (including tracking the last appended index)
Owns TAB completion behavior:
- builtin completion for the first token
- PATH executable completion
- bell on first ambiguous TAB, list on second TAB
Tokenizes a command line in-place and implements the quote/backslash rules used by this shell.
Builds a ShellPipeline by:
- splitting on
| - extracting per-command redirections
Extracts redirection tokens (>, >>, 2>, 2>>, etc.) and applies them via dup2().
Implements builtins:
echo,pwd,cd,type,history,exit
Runs external programs and pipelines:
fork()/execv()/waitpid()pipe()wiring across stages- builtin execution inside pipeline child processes
Finds executables either directly via / paths or by searching $PATH.