Ismail El Abbassi
Minishell interface

Systems · C2025

Minishell

A Unix shell in C that mimics bash, including the awkward parts.

C

libc and a hand-rolled libft

Pipelines

Arbitrary length, fds wired

7 builtins

Implemented in-process

Overview

A shell written in C with nothing but libc and a hand-rolled libft underneath: no parser generator, no readline substitute for the parsing itself, no shortcuts. It reads a line, decides what that line actually means, and runs it the way bash would.

I owned the front half — the lexer, the parser and the data structures that carry a command from raw text to something executable — while my teammate owned execution. That split is where the interesting work was. A shell grammar looks simple until you write it down: quoting changes whether expansion happens, a heredoc has to consume input before the pipeline runs, and redirections attach to a command rather than to the pipeline around it. Getting the representation right is most of the job; once the tree is honest, execution is almost mechanical.

What it does

  • 01A lexer and parser turning a raw command line into a structured representation
  • 02Pipelines of arbitrary length, with file descriptors wired between children
  • 03Input, output and append redirections, plus heredocs
  • 04Environment variable expansion, and $? for the last exit status
  • 05Quote handling where double quotes still expand and single quotes do not
  • 06The builtins bash runs in-process: echo, cd, pwd, export, unset, env and exit
  • 07Signal handling that keeps the prompt behaving under Ctrl-C and Ctrl-D