An open API service indexing awesome lists of open source software.

https://github.com/vidal-m/microshell

the lastest version of my microshell
https://github.com/vidal-m/microshell

42minishell c ecole42 examrank4

Last synced: 5 months ago
JSON representation

the lastest version of my microshell

Awesome Lists containing this project

README

          

#42Exam-rank-04
# microshell

Small shell (terminal) that executes simple commands with support for pipes (`|`) and separators (`;`). Project developed in 42 Luanda to understand the fundamentals of processes, `fork`, `execve`, `pipe` and `chdir`.

---

## ๐Ÿง  Objective

Implement a **microshell** capable of:
- Execute commands with multiple arguments
- Support chained commands with `;`
- Support `|` pipes
- Handle the built-in `cd` command
- Manage basic runtime errors and directories

---

## โš™๏ธ Compilation

```bash
cc -Wall -Wextra -Werror microshell.c -o microshell
```

๐Ÿงช Usage
Executing simple commands
bash
Copy
Edit
./microshell ls -l ; echo Hello
Execution with pipes
bash
Copy
Edit
./microshell ls -l | grep microshell
๐Ÿ“ cd command behavior
bash
Copy
Edit
./microshell cd nonexistent_folder
Exit:

vbnet
Copy
Edit
error: cd: cannot change directory to folder_inexistente
โŒ Error handling
cd with invalid arguments

commands that do not exist or fail to execute

fork or pipe failures are ignored in a simplified way (according to the project scope)

๐Ÿ”ง Implemented functions
exec_it โ€“ Execute commands with execve

cd โ€“ Own implementation of the cd command

ft_strlen โ€“ Helper function to count the length of strings

main โ€“ Handles parsing, fork, pipe, and execution control