Hassan Ed-dybNotesFR

Minishell

A shell, rebuilt from zero.

Minishell — A shell, rebuilt from zero.

A command-line shell built from scratch in C, replicating the core of Bash: command execution, pipes, redirections and signal handling.

The problem

Everyone uses a shell; few know what happens between pressing Enter and seeing output. Building one exposes how operating systems run programs.

How I built it

  1. 01A parser that turns the command line into commands, arguments, pipes and redirections.
  2. 02Execution with fork and execve, pipes between processes, and input and output redirection.
  3. 03Signal handling for Ctrl-C and Ctrl-\ that behaves like Bash.

Key takeaways

  • — Processes, file descriptors and how pipes really work.
  • — Writing a robust parser for messy human input.

Minishell was built as part of the software engineering curriculum at 1337 Coding School (42 Network, UM6P), where every project is built from scratch and reviewed by peers.