minishell is a Unix shell project from the 42 curriculum designed to help students understand and build their own command-line interpreter. The project focuses on process creation, pipes, redirections, and environment management.
Minishell is a simplified recreation of a real Unix shell like bash or zsh. It supports executing commands, piping, redirections, environment variables, and built-in shell commands. The goal is to understand how a shell works under the hood by re-implementing its core functionalities.
- ✅ Prompt that reads user input line by line
- ✅ Parse and split commands with arguments
- ✅ Built-in commands:
echo,cd,pwd,export,unset,env,exit - ✅ Execute external programs using
execve - ✅ Input/output redirections:
<,>,>>,<< - ✅ Pipe (
|) support - ✅ Environment variables management and
$expansion - ✅ Signal handling (
Ctrl-C,Ctrl-D, etc.) - ✅ Error messages and exit codes
git clone https://github.com/adil-ech/minishell
cd minishell
makeThis will generate the minishell executable.
./minishellStart typing commands like in a real shell:
ls -la | grep .c > out.txt
cat < in.txt | wc -l
export MYVAR=hellominishell/
├── src/
│ ├── main.c
│ ├── parser.c
│ ├── executor.c
│ ├── builtins/
│ ├── signals.c
│ ├── environment.c
│ ├── redirections.c
├── include/
│ └── minishell.h
├── libft/
├── Makefile
- Built-in command implementation
- Environment variable parsing and expansion
- Command execution and file descriptor duplication
- Redirection and pipeline management
- Memory and resource cleanup
- Signal handling with
SIGINT,SIGQUIT,SIGTERM
Not implemented in this version.
This project is part of the 42 Network curriculum and intended for academic use only.
You can read the official 42 Minishell subject here:
👉 Minishell Subject PDF
