https://github.com/mhmdhussein/42-minishell
A UNIX shell written in C for the 42 school curriculum. Supports command execution, pipes, redirections, environment variables, and built-in commands. Designed to mimic bash behavior while reinforcing knowledge of processes, signals, and file descriptors.
https://github.com/mhmdhussein/42-minishell
42 42-project bash c minishell process-management shell system-programming unix
Last synced: 2 months ago
JSON representation
A UNIX shell written in C for the 42 school curriculum. Supports command execution, pipes, redirections, environment variables, and built-in commands. Designed to mimic bash behavior while reinforcing knowledge of processes, signals, and file descriptors.
- Host: GitHub
- URL: https://github.com/mhmdhussein/42-minishell
- Owner: mhmdhussein
- License: mit
- Created: 2025-08-27T15:09:43.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-09-01T11:30:48.000Z (10 months ago)
- Last Synced: 2025-09-16T02:22:16.744Z (10 months ago)
- Topics: 42, 42-project, bash, c, minishell, process-management, shell, system-programming, unix
- Language: C
- Homepage:
- Size: 44.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minishell: A Bash Shell Implementation
## Overview
The **Minishell** project is a simplified implementation of a UNIX shell written in C. It replicates basic shell behavior such as executing commands, handling redirections, and managing processes. The project helps understand how shells work under the hood, including parsing, process management, and file descriptors. 🐚⚙️🖥️
## Features
* Command execution with `execve`.
* Built-in commands:
* `echo` (with `-n` option)
* `cd` (with relative/absolute paths and `~`)
* `pwd`
* `export`
* `unset`
* `env`
* `exit`
* Pipes (`|`) for inter-process communication.
* Input/output redirections (`<`, `>`, `>>`, `<<`).
* Environment variable expansion (`$VAR`).
* Signal handling (`Ctrl-C`, `Ctrl-\`, `Ctrl-D`) similar to bash.
* Robust error handling and exit codes matching bash behavior.
## Program Details
* **Program Name:** `minishell`
* **Usage:**
```bash
./minishell
```
* Minishell provides an interactive prompt where users can type commands and see results, just like a regular shell.
## Running the Program
1. Clone the repository:
```bash
git clone https://github.com/MohammadHusssein/42-minishell.git
cd 42-minishell
```
2. Compile the program:
```bash
make
```
3. Run the shell:
```bash
./minishell
```
## Acknowledgements
A huge thank you to my partner [Razane Traoui](https://github.com/razanetraoui) for her dedication, teamwork, and countless hours spent debugging and building this project together, couldn’t have done it without you! 🙌👩💻👨💻
## License
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use, modify, and distribute with proper attribution. 📜🔓✨