https://github.com/souleeater99/minishell
About Minishell - A 42 School project implementing a simplified Bash-like shell in C This educational project dives into core systems programming by recreating shell fundamentals: Process control (fork/exec, pipes, signals) File I/O (redirections, heredoc) Memory-managed environment (zero leaks) Bash-like features with 42's strict coding stand
https://github.com/souleeater99/minishell
1337cursus 1337school 42cursus 42projects 42school bash c file filedescriptor filesystem mangagement memory-management processes programming system unix-shell
Last synced: 6 months ago
JSON representation
About Minishell - A 42 School project implementing a simplified Bash-like shell in C This educational project dives into core systems programming by recreating shell fundamentals: Process control (fork/exec, pipes, signals) File I/O (redirections, heredoc) Memory-managed environment (zero leaks) Bash-like features with 42's strict coding stand
- Host: GitHub
- URL: https://github.com/souleeater99/minishell
- Owner: SouleEater99
- Created: 2024-05-14T16:38:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-25T16:33:52.000Z (7 months ago)
- Last Synced: 2025-03-25T17:42:28.415Z (7 months ago)
- Topics: 1337cursus, 1337school, 42cursus, 42projects, 42school, bash, c, file, filedescriptor, filesystem, mangagement, memory-management, processes, programming, system, unix-shell
- Language: C
- Homepage:
- Size: 5.6 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🐚 Minishell - As Beautiful as a Shell
**A 42 School project to create a simplified UNIX command-line interpreter**
*Inspired by bash, written in C with ❤️*[](LICENSE)
[](https://github.com/42School/norminette)## 🌟 Features
### Mandatory
- **Interactive prompt** with working command history (using GNU readline)
- **Command execution** via PATH or absolute/relative paths
- **Advanced parsing** with single quotes `'`, double quotes `"`, and environment variables (`$VAR`)
- **Redirections**:
- Input `<` and output `>` redirection
- Heredoc `<<` delimiter support
- Append mode `>>`
- **Pipes** (`|`) for multi-command chaining
- **Signal handling** for Ctrl-C, Ctrl-D, and Ctrl-\ (bash-like behavior)
- **Builtins**:
- `echo` with `-n` option
- `cd`, `pwd`, `exit`
- `export`, `unset`, `env` for environment management### Bonus (Optional)
- **Logical operators** `&&` and `||` with parentheses
- **Wildcard expansion** `*` for current directory
- Enhanced error handling and edge case management## 🛠️ Installation
1. Clone repository:
```bash
git clone https://github.com//minishell.git
cd minishell
### Compile with Makefile:```bash
make
```
### Run:```bash
./minishell
```
Requires GNU readline library (install via package manager if needed)## 🚀 Usage
```
$> ./minishell
minishell> ls -l | grep .c | wc -l
42
minishell> echo "Hello $USER" > greeting.txt
minishell> cat << EOF > output.txt
heredoc> Multiline
heredoc> input
heredoc> EOF
```
## 📚 Implementation Details
Language: C (C99 standard)Memory: Zero-leaks policy with careful allocation/free management
Architecture: Modular design with separate parsing/execution logic
Compliance: Follows 42 School Norm (strict code style guidelines)
Dependencies: Uses readline for line editing and history features
## 🧠 Challenges Overcome
Precise handling of quoting and expansion rulesFile descriptor management for complex redirections
Process synchronization in pipes
Signal handling in interactive/non-interactive modes
Environment variable management
## ⚠️ Limitations
Not a full POSIX-compliant shellLimited built-in commands compared to bash
No tilde expansion or advanced globbing
## 🤝 Contributing
Pull requests welcome! Please follow:42 School Norm guidelines
Test thoroughly
Document changes
## 📜 License
MIT License - See LICENSE for details"The best way to predict the future is to implement it." - Inspired by Alan Kay