Forked from the original 42 Berlin project repository (team of two)
A custom Unix shell implemented in C, inspired by bash.
This project focuses on understanding how command-line interpreters work internally, including process management, command execution, and inter-process communication.
This project was developed in a team of two.
- My partner implemented the command parser
- I implemented the execution layer and core shell behavior
- Designed and implemented the command execution pipeline
- Managed process creation using
fork,execve, andwait - Implemented support for pipes (
|) and input/output redirections (<,>,>>) - Built environment variable handling (
env,export,unset) - Implemented built-in commands (e.g.
cd,pwd,echo,exit) - Handled signal management (
Ctrl+C,Ctrl+D, etc.) - Ensured proper memory management and error handling
- Execution of system commands
- Support for pipelines and redirections
- Environment variable expansion
- Built-in shell commands
- Signal handling for interactive use
- Error handling for invalid input and edge cases
The shell operates in three main stages:
-
Parsing (implemented by my partner)
- Transforms user input into a structured representation of commands
-
Execution Pipeline (my responsibility)
- Creates processes using
fork - Connects them using pipes
- Executes commands using
execve
- Creates processes using
-
Process Coordination
- Waits for child processes
- Handles exit statuses
- Maintains shell state across executions
- C
- Unix system calls (
fork,execve,pipe,dup2,wait) - Standard C library
make./minishell- How Unix processes and shells work internally
- Managing multiple processes and inter-process communication
- Handling edge cases in command execution
- Writing robust, low-level C code with proper memory management
- Designing systems that separate parsing from execution
This project was built as part of the 42 Berlin curriculum.