minishell is a minimal Unix shell implemented in C as part of the 42 curriculum. It replicates core features of Bash, including command parsing, execution, environment variable handling, and redirections. This repository contains the mandatory part of the project and optionally includes bonus features.
- Displays a prompt and waits for user input.
- Parses and executes commands with arguments.
- Handles built-in commands like
cd,echo, andexport. - Supports piping, redirections, and environment variables.
- Implements signal handling to behave like Bash.
- Custom prompt and command input via
readline. - Built-in commands:
echo [-n]cd [path]pwdexportunsetenvexit
- Redirections:
- Input
< - Output
> - Append
>> - Here-document
<<
- Input
- Piping (
|) between commands. - Environment variable expansion (
$VAR,$?). - Proper signal handling (
ctrl-C,ctrl-D,ctrl-\).
- Unix-like OS (Linux or macOS).
- GNU Readline library.
-
Clone the repository:
git clone https://github.com/leite-tiago/minishell.git cd minishell -
Compile the project:
make
-
Run the shell:
./minishell
minishell/
βββ include/ # Header files
βββ src/ # Source code
β βββ main.c # Entry point
β βββ exec/ # Command execution
β βββ parser/ # Parsing logic
β βββ builtins/ # Built-in commands
β βββ signals/ # Signal handling
β βββ env/ # Environment management
βββ libft/ # Custom standard library (if used)
βββ Makefile # Build instructions
βββ README.md # Project documentation
- GNU Readline - For interactive input.
- C (following the Norm coding standard).
- Advanced wildcard and globbing support.
- Job control (
fg,bg,jobs). - History persistence across sessions.
This project is part of the 42 Network curriculum. Grateful to the 42 community for collaboration and support.
This project is licensed under the MIT License. See the LICENSE file for details.