Overview

Mini Shell (minishell) is a recreation of Bash, implementing a complete command-line interpreter from scratch in C. This is one of the most challenging projects in the 42 curriculum, combining parsing, process management, signal handling, and environment variable expansion.

Team project with Addame M.

What We Built

  • Lexer & Parser: tokenization of user input, handling quotes, escape characters, and operator precedence
  • Command Execution: fork() + execve() with proper PATH resolution
  • Pipes: multi-command pipelines (cmd1 | cmd2 | cmd3)
  • Redirections: input (<), output (>), append (>>), and heredoc (<<)
  • Built-in Commands: echo, cd, pwd, export, unset, env, exit
  • Environment Variables: $VAR expansion, $? exit status
  • Signal Handling: Ctrl+C, Ctrl+D, Ctrl+\ behave like Bash

Key Concepts

  • Building a recursive descent parser for shell grammar
  • Process groups, signal propagation, and terminal control
  • The fork()/execve()/waitpid() execution model
  • Memory management in a long-running process (leak prevention)
  • Understanding how Bash actually works under the hood