https://github.com/nihilantropy/minishell
Minishell: aka Minihell :fire:
https://github.com/nihilantropy/minishell
42 42rome c minihell minishell programming shell
Last synced: 3 months ago
JSON representation
Minishell: aka Minihell :fire:
- Host: GitHub
- URL: https://github.com/nihilantropy/minishell
- Owner: Nihilantropy
- Created: 2024-05-06T13:43:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-17T16:06:11.000Z (9 months ago)
- Last Synced: 2024-09-18T13:33:53.845Z (9 months ago)
- Topics: 42, 42rome, c, minihell, minishell, programming, shell
- Language: C
- Homepage:
- Size: 446 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minishell: aka Minihell :fire:!
Welcome to Minihell, your very own journey into the magical world of command-line interfaces!
đ Imagine it as your personal little bash, crafted from scratch, and, like all things small and wonderful, itâs as beautiful as a shell.## đ Project Overview
Minihell is a project that lets you create a basic yet functional shell, akin to the one you use every day but with a twist: itâs your creation!
Youâll dive deep into the inner workings of processes, file descriptors, and command execution.
By the end of this adventure, youâll have your own shell that mimics many of the features of bash, but with your unique touch.## Why Build a Shell?
Once upon a time, developers communicated with computers by flipping 1/0 switches. This wasnât
just tediousâit was downright frustrating! So, they invented something more human: the shell. It
allowed them to interact with computers using commands typed in plain (well, sort of) English. With
Minihell, youâll step into their shoes, tackling the challenges they faced before the days of Windows
and fancy GUIs.## đŻ The Mission
Your task is to create a shell that can:
1. **Display a Prompt**: When itâs time for a new command, your shell will await politely.
2. **Handle History**: Like a good friend, your shell remembers what youâve said before.
3. **Execute Commands**: Whether itâs finding an executable in your PATH or running something
by absolute or relative path, your shellâs got you covered.4. **Signal Handling**: Itâs tough to avoid global variables, but try to use just one for signal handling.
Itâs like a tiny flag your shell waves when something important happens.5. **Quotes and Meta-Characters**: Your shell understands the power of quotes (single `'` and double `"`), and it wonât misinterpret them.
6. **Redirections**: `<`, `>`, `<<`, and `>>` â these symbols have special meanings, and your shell knows them all.
7. **Pipes**: Your shell will expertly pass the output of one command to the input of another, just like bash.
8. **Environment Variables**: `$VARIABLES` are magical tokens that your shell will expand to their corresponding values.
9. **Exit Status**: `$?` tells the story of the last commandâs success or failure.
10. **Interactive Mode**: In the heat of command-line battle, your shell handles ctrl-C, ctrl-D, and ctrl-\ with grace:
- `ctrl-C` displays a new prompt on a new line.
- `ctrl-D` exits the shell.
- `ctrl-\` does nothing.## đ ď¸ Builtin Commands
Minihell will also support several built-in commands, including:
- [x] **echo** (with -n option)
- [x] **cd** (change directory)
- [x] **pwd** (print working directory)
- [x] **export** (set environment variables)
- [x] **unset** (unset environment variables)
- [x] **env** (print environment)
- [x] **exit** (close the shell)
## âď¸ Bonus Challenges
Once youâve perfected the essentials, you can take on these bonus tasks (not present in this project):
- [ ] **Logical Operators**: Implement **`&&`** and **`||`** for command chaining, with support for parentheses to dictate priority.
- [ ] **Wildcards**: Allow **`*`** to match files in the current directory, adding a bit of flair to your command execution.
## đ Getting Started
### Prerequisites
- Ensure youâre working in a Unix-like environment.
- Install the necessary libraries and headers for readline.
### Installation
You can git clone the repository by using https protocol
```bash
git clone https://github.com/Nihilantropy/Minishell.git
```then you can access the directory and run the make command
```bash
cd Minishell && make
```### Usage
Fire up your this bad boy:
```bash
./minishell
```From here you can have some fun, testing basic commands, input and output redirections, builtin commands
and pipelines :smile:!## :muscle: It's your turn!
Now that you know how it works it's time to buil your own hell... ehm I mean shell :eyes:!
### Testing
While testing is not mandatory, itâs highly encouraged! Creating tests will help you understand
how your shell behaves in various scenarios and is incredibly helpful during peer evaluations.## đ Final Submission
When youâre done crafting your Minihell, submit your work to your assigned Git repository.
Double-check everything because only whatâs in your repo will be graded!If you are just a C programmer enthusiast... Great job! Upload it to your GitHub and see
if you can get any reviews!## đĽ Peer Evaluations
After submission, youâll participate in peer evaluations. This is your chance to see how your
peers approached the same challenge and to show off your own work. The more thorough and fair you
are in these evaluations, the better the feedback youâll receive.## Conclusion
Congratulations on embarking on this shell-building adventure! We hope you enjoy every bit of
it and walk away with a deeper understanding of how shells work under the hood.May your code be bug-free and your shell flawless!
Happy hacking! đ
## Leave a strar :star:!
If you'd like to see an in-depth analisy of this code, leave a star to let us know! :love_letter: