Minishell is a minimal Unix shell written in C, developed as part of the 42 School curriculum. This shell provides a basic command-line interface with support for running executable commands and handling a small set of built-in functions. The project emphasizes understanding of Unix process management, file descriptors, and environment handling.
- Language: C
- Executable:
minishell - Core topics:
- Process creation,
- command execution,
- environment management,
- error handling
- Original subject
The project aims to provide a foundational understanding of how a shell works in Unix-like operating systems:
- Build a simple shell interpreter
- Understand process creation using
forkandexecve - Work with the environment and the
PATHvariable - Handle command input/output and system-level errors gracefully
- Implement basic shell built-ins from scratch
- Display a shell prompt (e.g.
$>), read and execute commands - Use
PATHto locate executables or run absolute/relative paths - Show error messages if a command cannot be found or executed
- Correctly handle and pass environment variables (
char **environ) - Implement the following built-in commands:
echocdsetenvunsetenvenvexit
- Pipes (
|) - Redirections (
>,<,>>) - Logical operators (
&&,||) - Quoting and variable expansion
- Multiline input
You are only allowed to use the following C functions for the mandatory part:
- Memory:
malloc,free - I/O:
open,close,read,write - Directory:
opendir,readdir,closedir,getcwd,chdir - File info:
stat,lstat,fstat - Process:
fork,execve,wait,waitpid,wait3,wait4 - Signals:
signal,kill - Misc:
access,exit
make| Target | Description |
|---|---|
all |
Build the minishell binary |
clean |
Remove object files |
fclean |
Remove object files and binary |
re |
Rebuild the project |
These features are not required but implemented for additional challenge:
- Signal handling (e.g.
Ctrl-C) - Empty $PATH handling
- Command separation using
;
Educational project for the 42 School curriculum.
