A custom UNIX shell written in C from scratch, built as a collaboration project at ALX.
Overview
hsh is a UNIX command interpreter written in C, built to match /bin/sh's output and error messages.
It was a collaboration project in the ALX Software Engineering programme, built as a pair.
Simple Shell implements process management with fork, execve and wait, a command-line parser with PATH resolution and tokenisation, and manual memory management.
Beyond the basics it handles ; separated commands, single, double and escaped quotes with multi-line input, # comments, aliases (including trailing-space chaining), $?, $$ and environment variable expansion, and eight builtins: alias, cd, env, exec, exit, help, setenv and unsetenv.
- Parser and tokenizer
- Builtins
- PATH resolution
- Error output parity with sh
The terminal above runs a TypeScript port that follows the C source: the same parsing order, builtins, help text and error messages. Browsers cannot fork or execve, so programs like ls and cat are simulated against a copy of the real repository.
Understanding how a UNIX shell works at the systems level, using only the C standard library.
100% project score with zero memory leaks across all edge cases.
- C