Mini Unix Shell with Pipes and Redirection
A simplified command shell that parses user input, forks and execs external commands, and supports pipes and I/O redirection (<, >, >>). Learners practice fork/exec/wait, pipe() and dup2() system calls, and command-line parsing.
- Estimate
- ~12h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
unistd.h · sys/wait.h · fcntl.h
Project roadmap
- 01
Build the read-eval loop and tokenizer
~1.5hRead a line of input and tokenize it into command and arguments respecting quoting.
- 02
Implement single-command execution
~2hFork a child process, exec the command with execvp, and wait for it in the parent.
- 03
Add I/O redirection support
~2.5hDetect <, >, >> tokens and use dup2 to redirect the child's stdin/stdout to files before exec.
- 04
Implement multi-stage pipes
~3hSupport chaining commands with | by creating pipes and connecting each stage's stdout to the next's stdin.
- 05
Add built-in commands
~1.5hImplement cd, exit, and pwd as built-ins handled directly in the parent process rather than forked.
- 06
Add basic job control feedback
~1.5hPrint exit status of foreground commands and handle Ctrl-C gracefully without killing the shell.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack