Minishell is a Unix shell recreation project written in C, developed as the first group project (duo) at 42 School The goal is to design a minimal Bash-like shell, handling user input, executing commands, and managing the environment using low-level system calls.
This project introduces essential topics such as:
- Process creation and synchronization
- File descriptors and redirection
- Pipes
- Signal handling
- Terminal interaction and input parsing
- Parses and executes commands using
execve. - Supports absolute, relative, and PATH-based executables.
- Internal handling of built-in commands (no child process spawned).
echo [-n]cd [dir]pwdexportunsetenvexit
- Handles
'single quotes'and"double quotes". - Expands environment variables like
$USERor$?.
<standard input>standard output (overwrite)>>standard output (append)<<heredoc support
- Fully supports pipelines (
|) chaining multiple commands.
Ctrl-C: resets promptCtrl-D: exits shellCtrl-\: ignored in interactive mode
- Only one global variable allowed (to track signal values).
make./minishell$> echo "Hello, world!"
Hello, world!
$> export MOOD=calm
$> echo "Today I feel $MOOD"
Today I feel calm
$> cat << EOF
> This is a heredoc input
> EOF
This is a heredoc inputThis project uses the readline library, which causes known false-positive memory leaks in Valgrind.
A suppression file (supp.supp) is included to ignore these.
valgrind --leak-check=full --show-leak-kinds=all --suppressions=./supp.supp ./minishell- Compliant with the 42 coding norm
- Uses the
readlinelibrary for input and history - Memory must be managed strictly (except
readlineleaks) - Only one global variable
- Makefile includes:
all,clean,fclean,re, andbonus
