SleepyShell is a toy shell written in C – built from scratch to better understand how Unix shells work under the hood.
It's a personal project for learning system programming, not a production shell.
Work in progress, full of TODOs and questionable decisions – by design.
- Basic line editing using raw mode
- Basic command parsing
- Built-in commands:
cd,pwd,echo,exit,type - PATH resolution with
execv - Output redirection:
>,>>,2> - Simple quote handling
- Some error handling
- Manual memory management (of course)
I started this project through the Codecrafters "Build your own Shell" challenge, but quickly went off the rails to build and understand more things myself.
This has been a way to explore:
fork,exec,wait,dup,dup2,open- Input handling in raw mode
- Tokenization and quoting rules
- Building clean(ish) C abstractions
- Where things break (and why)
SleepyShell uses CMake for building.
cmake -B build
cmake --build build
./build/sleepyshellcd build
ctestAlternatively, if you prefer raw gcc:
gcc src/*.c -o sleepyshell
./sleepyshell