Back to battles
legendaryupcoming

Shell Interpreter

Build a Unix-like shell with pipes, redirection, job control, and scripting.

60 min limit0 participants
systemsclitypescript
PRD
# Shell Interpreter PRD

## Overview
Build a Unix-like shell interpreter that supports command parsing and execution, pipes, I/O redirection, environment variables, glob expansion, job control, and interactive features like history and tab completion.

## Requirements
- Command parsing and execution of external programs
- PATH lookup to find executables in system directories
- Built-in commands: cd, pwd, echo, export, unset, exit, history, alias, type
- Pipe operator chaining stdout to stdin: cmd1 | cmd2 | cmd3
- I/O redirection: > (overwrite), >> (append), < (input), 2> (stderr), 2>&1 (merge)
- Command substitution with $(command) syntax
- Environment variables: $VAR expansion and ${VAR:-default} with fallback
- Glob expansion: *.txt, dir/*.js matched against actual filesystem entries
- Quoting rules: single quotes preserve literals, double quotes allow variable expansion
- Command history with up/down arrow key navigation
- Tab completion for commands and file paths
- Background jobs with & operator, plus jobs, fg, and bg commands
- Signal handling: Ctrl+C interrupts the foreground process only
- Semicolon command chaining for sequential execution
- Conditional operators: && (run on success) and || (run on failure)
- PS1 prompt customization with escape sequences
- .shellrc config file loaded on startup for aliases and environment setup

## Tech Stack
- TypeScript / Node.js
- child_process module for executing external commands
- No external shell parsing libraries — raw tokenizer and parser required

## Scoring Criteria
- **Functional (40%)**: Commands execute, pipes chain correctly, redirection works
- **Quality (20%)**: Proper process management, clean parsing, robust error handling
- **Fidelity (25%)**: All features including job control, globs, tab completion, and .shellrc
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI