Minishell is a simplified Unix shell written in C as part of the 42 curriculum. The goal of this project is to understand how a shell works by recreating its core functionalities, including command execution, environment variables, pipes, and redirections.
This project focuses on process management, file descriptors, signals, and parsing.
Minishell implements the following features:
-
Display a prompt and wait for user input
-
Execute commands with absolute or relative paths
-
Handle environment variables (
$VAR) -
Built-in commands:
- echo (with
-n) - cd
- pwd
- export
- unset
- env
- exit
- echo (with
-
Pipes (
|) -
Redirections:
- Input
< - Output
> - Append
>> - Heredoc
<<
- Input
-
Signal handling:
Ctrl-CCtrl-DCtrl-\
-
Proper error handling and exit status management
Clone the repository and compile the project:
git clone https://github.com/minicube707/C--Minishell.git
cd minishell
makeThis will generate the executable:
./minishellOnce launched, Minishell behaves like a basic shell:
Minishell> echo Hello World
Hello World
Minishell> ls -l | grep minishellTo exit:
Minishell> exitA file containing multiple execution examples and test cases is available at: doc/execution-exemple.txt
- Wildcards (
*) limited to the current working directory - Logical operators (
&&,||) - Environment variable expansion inside double quotes (
") and single quotes (')
- Wildcards (
*) behaving like in Bash - Subshell management with parentheses
()
- How shells manage processes and file descriptors
- Parsing complex user input
- Implementing built-in commands
- Handling Unix signals correctly
- Memory management and error handling in C
-
fmotte- -> Execution
- -> Built-in
- ->
$expand - ->
*expand - -> Manage fd
-
lupayet- -> Parsing
- -> Lexing
- -> Built-in
- -> Manage signal
⭐ Project validated: 125 / 125
This project is part of the 42 School curriculum and is intended for educational purposes only.