Overview
Minishell is a simplified Unix shell written in C that replicates the core functionality of bash. It provides an interactive command-line interface with command history, process management, pipes, I/O redirections, heredocs, and environment variable expansion.
Built as a 42/Hive Helsinki team project, it demonstrates deep understanding of fork/exec process models, file descriptor management, signal handling, and lexical parsing — all without any higher-level shell libraries.
Key Features
- Lexer and recursive parser with quote and special-character handling
- Pipe operator (
|) with concurrent child process execution - Input (
<), output (>), and append (>>) redirections - Heredoc support (
<<) with variable expansion and a 16-heredoc limit - Environment variable expansion (
$VAR,${VAR},$?) - All essential built-ins:
echo,cd,pwd,export,unset,env,exit - Proper SIGINT / SIGQUIT / SIGPIPE signal handling mirroring bash behaviour
Tech Stack
My Role
This was a two-person project. I was responsible for the execution layer — implementing pipes, heredocs, built-ins, and signal handling. My partner handled the lexer and parser. I also led the overall integration testing, verifying behaviour against bash across edge cases in pipelines and redirections.
Challenges & Learnings
The trickiest part was correctly propagating file descriptors through a pipeline of arbitrary length while ensuring every duplicate fd is closed in every child and parent process. Getting signal behaviour to exactly match bash — especially inside heredocs and pipelines — required careful re-reading of POSIX signal semantics and incremental testing against the real shell.