This project has been created as part of the 42 curriculum by nofelten and acohaut.
nofelten & acohaut
(piscine of september's 2025 - 42 PARIS)
starting date : 26/01/2026
last update : 10/03/2026
The shell is a command language interpreter.
Minishell is a project that teaches us (after Pipex) processes (parent and child), how to execute a command as a shell, redirect streams, parse inputs (similar as bash) etc..
We need to mimic the bash :
lexer (tokenizer) > parser (syntax) > expander (env var) > redirection (pipe/fd) > executor
We need to handle signals (CTRL-C, CTRL-D, CTRL-\) and built-in functions as well :
- echo (with flag -n)
- cd
- env
- exit
- unset
- export
- pwd
Usage
- make all
- ./minishell (no args)
- execute commands in our minishell
Examples
in minishell :
> ls -la | grep "." | wc
> < Makefile wc | cat > out
> << EOF cat
> echo "hi $USER, you're currently here : $PWD"
> export NEWVAR=blabla (then again export to see the result)
> unset NEWVAR
> cd srcs/
> echo -n hello >> out
> echo $?
> env
> pwdCheck leaks
valgrind --suppressions=readline.supp --leak-check=full --show-leak-kinds=all ./minishell
Bash features :
(https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html)
(https://www.gnu.org/software/bash/manual/bash.html)
Fork() : (https://www.youtube.com/watch?v=PwxTbksJ2fo)
Open() : (https://www.codequoi.com/en/handling-a-file-by-its-descriptor-in-c/)
Signals : (https://www.geeksforgeeks.org/c/signals-c-language/)
Built-in functions : man pages (#RTFM)
Other ressources : Github and IA -> for researches and understanding concepts or examples usages for functions allowed by the subject