A fully functional Unix shell built in C, designed to mimic the behavior of Bash while reinforcing knowledge of process management, pipes, signals, and parsing. It provides a complete interactive shell experience with built-in commands, environment handling, and robust execution flow.
- Interactive prompt for executing commands
- Built-in commands:
cd,echo,env,exit,export,pwd,unset - Pipes (
|) and redirections (<,>,>>,<<) - Environment variable expansion (e.g.
$USER,$PATH) - Signal handling for
Ctrl + C,Ctrl + D, andCtrl + \ - Error messages consistent with Bash
- Memory-safe execution (no leaks, fully cleaned after exit)
- C – Core language
- GNU Readline – For interactive input
- POSIX system calls –
fork,execvp,pipe,dup2,wait,signal, etc. - Makefile – For easy build and management
- Clone the repository:
git clone https://github.com/Felipp3san/42-minishell
cd 42-minishell- Compile the project:
make- Run the executable:
./minishell- Run commands just like in Bash:
minishell$ ls -l | grep minishell- Set and use environment variables:
minishell$ export NAME=Felippe
minishell$ echo "Hello $NAME"
Hello Felippe- Redirect input and output:
minishell$ cat < input.txt | grep "data" > output.txt- Exit the shell:
minishell$ exit- Build the executable:
make- Remove object files:
make clean- Remove all binaries and rebuild:
make re.
├── include/ # Header files
├── src/ # Source files
│ ├── builtins/ # Built-in shell commands
│ ├── command/ # Command structures
│ ├── debug/ # Debugging utilities
│ ├── env/ # Environment variable management
│ ├── executor/ # Command executor logic
│ ├── expander/ # Variable and wildcard expansion
│ ├── heredoc/ # Here-document handling
│ ├── parser/ # Parsing logic for commands
│ ├── path/ # Path resolution and management
│ ├── signals/ # Signal handling (e.g., SIGINT)
│ ├── token/ # Token structures
│ ├── tokenizer/ # Lexical analysis
│ ├── ui/ # User interface components
│ ├── utils/ # Utility functions
│ └── main.c # Program entry point
└── libft/ # Custom Libft library
Educational project under 42 School academic policy.