Minishell is a Unix shell implementation written in C as part of the 42 School curriculum. It reproduces core Bash behaviors including command execution, pipelines, redirections, environment variable expansion, built-in commands, and signal handling. The project focuses on process management, file descriptor manipulation, parsing logic, and system-level programming concepts.
Overview
- Language: C
- Architecture: Modular parsing and execution pipeline
- Process Handling: fork, execve, wait
- Inter-process Communication: pipes
- File Descriptor Management: dup2, redirections
- Environment Handling: variable expansion and export management
- Signal Handling: ctrl-c, ctrl-d, ctrl-\
- Focus: Low-level Unix systems programming
- Prompt display
- Command history (up and down arrows)
- System executables available from the environment (
ls,cat,grep, etc.) - Local executables (
./minishell) - Builtin commands :
echo(and option-n)
cd(with only a relative or absolute path)
pwd(no options)
export(no options)
unset(no options)
env(no options or arguments)
exit(with exit number but no other options) - Pipes
|which redirect output from one command to input for the next - Redirections:
>redirects output
>>redirects output in append mode
<redirects input
<< DELIMITERdisplays a new prompt, reads user input until reachingDELIMITER, redirects user input to command input (does not update history) - Environment variables (i.e.
$USERor$VAR) that expand to their values.
$?expands to the exit status of the most recently executed foreground pipeline. - User keyboard signals:
ctrl-cdisplays a new prompt line.
ctrl-dexits minishell
ctrl-/does nothing
However, Minishell does not support /, ;, &&, ||, or wildcards.
git clone <repository_url>
cd minishell
make./minishell (anything from listed above)./minishell cat Makefile | grep o > out