Minishell
A Unix shell built in C, with command execution, built-ins, pipes, redirections, quoting and environment variable expansion.
C · Processes · Parsing
The problem
Turn a command line into predictable shell behavior, while coordinating parsing, expansion, redirections and child processes.
A design decision
Keep parsing and execution separate. The execution layer walks the command list, creates pipes for connected commands, and uses fork and dup2 to wire each child into the pipeline.
A debugging edge case
A reader cannot see EOF while any process still holds a pipe write end. The parent closes each write end after forking, while children close the unused read end. This makes descriptor ownership a useful debugging checklist.
A possible next iteration
A useful next iteration would automate Bash comparison tests for quoted variables, heredocs, exit status and broken pipelines.
Explore the implementation
This study describes the source at commit ea06a8f. The
edge case is a code walkthrough, not a personal debugging story.