Aimane.OS
← Back to Portfolio
CASE STUDY // SYSTEMSSource Code

Minishell

UNIX Command Line Interpreter in C

A custom UNIX shell developed in pure C as part of the 42 Network curriculum. It recreates core bash functionalities including command execution path resolving, pipelines, input/output redirections, environment variable expansions, and signal handling.

LIVE ARCHITECTURE SIMULATORInteractive Demo
Initializing Minishell Pipeline Simulator...
Lines of C
4,500+
Memory Leaks
0 bytes
Norminette
100% Compliant
The Challenge

Handling complex nested tokens, quotes, syntax edge cases, and preventing memory leaks or zombie processes when managing concurrent piped commands.

Architectural Approach

Built a custom Lexer and Abstract Syntax Tree (AST) parser, managed process branching via fork() & execve(), implemented a dual pipeline runner using pipe() and dup2(), and engineered signal handlers for SIGINT/SIGQUIT.

Engineering Impact

Demonstrates low-level UNIX process management, file descriptor manipulation, strict dynamic memory control, and defensive programming in C.

Technical Key Highlights

  • ▸Custom AST Parser for complex quote rules & variable expansion
  • ▸Process management with fork(), execve(), waitpid() & signal traps
  • ▸Robust error reporting matching GNU Bash standards
  • ▸Zero memory leaks verified under Valgrind

Architectural Subsystems

Layer 01Lexer -> Tokenizer -> AST Construction
Layer 02Environment Map (Key-Value linked list)
Layer 03Pipe Executor Matrix (stdin/stdout redirections)
Layer 04Signal Dispatcher (Interactive vs Child mode)
Technologies Used:CUNIX APIPipes & SignalsAST ParserValgrindMakefile