A POSIX-style shell implemented in Rust as a learning project through the CodeCrafters shell challenge.
- Lexing and parsing shell input into pipelines and command invocations
- Execution of built-in commands and external programs
- Output/error redirection and pipeline composition
- Background job tracking
- Simple shell state management for history, variable declaration, and completion records
- A REPL built on
rustyline
- Built-ins:
cd,pwd,echo,type,exit,history,jobs,declare,complete - Pipelines with
| - Background execution with
& - Redirection:
>,>>,2>,2>> - Basic argument parsing with quotes and escapes
- Variable expansion for declared values
- Language: Rust
- Edition: 2021
- Primary dependencies:
rustyline,regex - Structure:
src/syntax: lexer, tokens, parsersrc/commands: built-ins, expansion, execution, redirection, command resolutionsrc/state: in-memory stores for history, jobs, declarations, completionssrc/repl: interactive shell session
The unit test suite focuses on the parts most likely to cause behavioral regressions:
- lexical scanning
- parsing
- argument expansion
- redirection and executable resolution
- state stores
- selected built-ins with meaningful logic
Current project-source coverage is above 60%.
./your_program.shRun tests with:
cargo testThis is not intended to be a production shell. It is a systems programming exercise focused on parser design, process orchestration, and building a clean command execution flow in Rust.