A small Unix shell in C, written to find out how a shell actually works.
spsh.c- main loop, reading input, running programs with fork + execbuildin.c- built-ins (cd,pwd,echo,exit) and<,>,>>redirectionutil.c- prompt and banner
Build with make, run with ./spsh.
The goal was to understand how a shell works, and it got there: it runs programs, has a few built-ins and handles redirection.
These aren't supported:
- Pipes (
ls | grep foo) - Ctrl+C handling (right now it kills the shell, not just the running command)
- Quotes and escapes (
echo "hello world",cd "My Folder") - Redirection without spaces (
ls>out.txt) - Environment variables:
$HOME,$?,~, plusexportandunset - Exit codes:
$?andexit N - Chaining with
&&,||and; - Background jobs with
&, plusjobs,fgandbg - Command history and arrow-key line editing