Minishell: Writing My Own Bash
September 15, 2022
École 42
Related Posts
Hi! Minishell is the first big team project of the cursus — I built it together with my teammate cryonayes. The goal: a working shell that behaves like bash for a serious subset of its features.
PATH,ls | grep c | wc -l) and redirections (<, >, >>, heredoc <<),$HOME, $?) with single/double quote semantics,echo, cd, pwd, export, unset, env, exit,Ctrl-C, Ctrl-D, Ctrl-\) in both interactive and child contexts.Parsing is the visible part — tokenizing, handling quotes, building a command table. The invisible part is process management: fork, execve, dup2 for plumbing file descriptors, waitpid and exit codes. After minishell, the terminal stops being magic: you know exactly what happens between pressing Enter and seeing output. Working as a pair also taught us to split ownership cleanly — one of us deep in the parser, the other in execution, meeting at a shared data structure.
Source code: github.com/cryonayes/minishell
