Recreating a simplified Bash shell - 42 School project
Minishell is a 42 School project that aims to recreate a simplified Bash shell, handling commands, pipes, redirections, environment variables and built-in commands, with proper signal and memory management.
This project focuses on learning Unix process management, input parsing, file descriptors, and the design of a minimal shell that behaves similarly to Bash in its core functionality.
Minishell implements:
- A custom prompt waiting for user input
- Command execution via absolute/relative path or
$PATH - History using the readline library
- Input parsing with support for:
- Quoting:
'and"(with correct expansion behavior) - Escaped characters inside quotes
- Variable expansion (
$VAR,$?)
- Quoting:
- Built-in commands:
echo,cd,pwd,export,unset,env,exit
- Redirections:
>: output redirection>>: output append<: input redirection<<: heredoc (with optional variable expansion)
- Pipe support (
|) - Proper signal handling:
Ctrl-C→ display new promptCtrl-D→ exit shellCtrl-\→ ignored
- Only one global variable used to store the signal number (as per subject constraints)
- No support for bonus features like
&&,||,(), or wildcards
- GCC compiler
- Make
1. Clone the repository
git clone https://github.com/TiagoDev88/minishell.git2. Compile
make3. Run
./minishell- Then enter commands as you would in a typical Bash session:
minishell$ echo Hello, world!
Hello, world!42 login: tfilipe- / GitHub: @TiagoDev88
42 login: edfreder / GitHub: @EdgarFir
