minishell
is a shell implementation project from the 42 curriculum.
It replicates the behavior of a simplified bash, handling command execution, pipes, redirections, environment variables, and builtins.
The goal of minishell
is to implement a functional shell, learning the fundamentals of process creation, file descriptors, and terminal behavior, while respecting the exact bash-like behavior for many features.
You will:
- Implement a parser for command input
- Manage processes and file descriptors
- Handle pipes (
|
) and redirections (>
,<
,>>
,<<
) - Support environment variable expansion (
$HOME
,$PATH
, etc.) - Implement core builtins such as
cd
,echo
,pwd
,export
,unset
,env
, andexit
- Manage signals (
Ctrl-C
,Ctrl-D
,Ctrl-\
) correctly
Concept | Description |
---|---|
Process & Fork | Creation and management of child processes |
Execve | System call to execute new programs |
File Descriptors | Handle input/output and redirections |
Pipes | Connect multiple commands together |
Environment Vars | Expand and manipulate shell variables |
Signals | Handle interrupts like Ctrl-C gracefully |
- Must mimic bash behavior as closely as possible
- Only allowed functions: a restricted set from libc and POSIX
- Correct handling of memory (no leaks allowed)
- Proper exit codes for each command