Fatih Çil

Self-Taught Developer

Software Engineer

Programmer

Game Developer

Fatih Çil

Self-Taught Developer

Software Engineer

Programmer

Game Developer

Blog Post

Minishell: Writing My Own Bash

September 15, 2022 École 42

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.

What our shell does

  • A prompt with history, running commands found via PATH,
  • Pipes (ls | grep c | wc -l) and redirections (<, >, >>, heredoc <<),
  • Environment variable expansion ($HOME, $?) with single/double quote semantics,
  • Builtins: echo, cd, pwd, export, unset, env, exit,
  • Correct signal behaviour (Ctrl-C, Ctrl-D, Ctrl-\) in both interactive and child contexts.

What it really teaches

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

42 minishell badge

Related Posts