Minishell is a project from 42 School focused on implementing a simplified shell inspired by Bash. The goal is to gain a deep understanding of how Unix shells work, including command parsing, process execution, input/output redirection, and variable expansion.
This project helps develop skills in C programming, Unix systems, processes and signals, as well as reinforcing concepts in data structures and string manipulation.
The Minishell includes:
Execution of built-in commands:
cd– change the current directory.echo– display messages in the standard output.pwd– print the current directory.export– set environment variables.unset– remove environment variables.env– list environment variables.exit– exit the shell.- Execution of
external commands(like ls, cat, etc.). Pipelines (|)to chain commands.
Redirection:
>and>>(output to file)<(input from file)- Variable
expansion($VAR). Signal handling(CTRL+C, CTRL+) in a controlled way.- Command
parsingwith single and double quotes.
- Language: C
- System: Unix/Linux
- Compiler: cc
- Standard C libraries (unistd.h, stdlib.h, stdio.h, etc.)
minishell/
│
├── src/ # Minishell source code
├── include/ # Headers and structs
├── Makefile # Compilation rules
├── README.md # Documentation
└── tests/ # Scripts to test featuresTo compile the project, use the included Makefile:
make
This will generate the executable:
./minishell
To clean compiled files:
make clean
make fclean # Removes the executable as well
Once the shell starts, you can type commands like in Bash:
$ echo "Hello, Minishell!"
Hello, Minishell!
$ pwd
/home/user
$ ls -l | grep ".c"
main.c
utils.c
Unix/Linux Man Pages Bash documentation for reference Material provided by 42 School
Allan Rabelo & Miguel Queiros