Overview
Tinyshell is a small Unix shell that supports the features people use every day: running programs, chaining them with pipes, redirecting input and output, and managing background jobs.
How it works
- A hand-written tokenizer and parser turn each command line into a tree of commands, pipes and redirections.
- Commands run in child processes created with fork and exec, connected through pipes and file descriptors.
- Signal handlers forward Ctrl+C and Ctrl+Z to the foreground job, and the built-in jobs, fg and bg commands manage the rest.
Results
Tinyshell passes a 300-case test suite covering edge cases such as quoting, nested redirections and orphaned processes, with zero memory leaks reported by Valgrind.
What I learned
Building it made processes, file descriptors and signals concrete for me, and taught me to debug with strace and gdb instead of guesswork.