Skip to main content
All projects

Minishell

A UNIX shell — processes, pipes, redirections, signals

A command interpreter written in C: process creation, pipe chaining, redirections, environment variables and signal handling.

Screenshots

Context

A shell is a great revealer: it forces you to properly understand `fork`, `execve`, `dup2` and `waitpid` — and above all to handle the edge cases, like a redirection that fails, a signal received while a child is running, or a command that cannot be found in the middle of a pipeline. Parsing took as much work as execution: quotes, expansions and operators have to be processed in the right order for the behaviour to match bash.

Features

  • Complete UNIX command interpreter
  • Pipe and redirection handling
  • Environment variables and signals
  • Built-ins: echo, cd, pwd, export, unset, env, exit
  • Command history
  • Robust parsing with error handling