A mini shell implementation in C as part of the École 42 curriculum. The goal of this project is to understand how a real shell works: parsing, command execution, pipes, redirections, signals, and environment variables.
- Interactive prompt (terminal mode)
- Command history (if using
readline) - Command execution through
PATH - Builtins:
echo(with-n)cdpwdexportunsetenvexit
- Single and double quotes handling (
'...',"...") - Variable expansion (
$VAR,$?) - Pipes (
|) - Redirections:
>(truncate)>>(append)<(input)<<(heredoc)
- Signal handling (e.g.
Ctrl-C,Ctrl-\) with bash-like behavior
- Linux / macOS
make- C compiler (gcc/clang)
- (Optional)
readlineinstalled
makeThis generates the executable:
./minishell./minishellExamples:
minishell$ echo "hello world"
minishell$ ls -la | grep minishell > out.txt
minishell$ cat < out.txt- The project aims to replicate a subset of bash behavior.
- Make sure to test edge cases: spacing, unclosed quotes, consecutive pipes, combined redirections, etc.
Quick ideas:
# variables
echo $HOME
echo $?
# pipes/redirections
ls | wc -l
echo test > a && cat < a
echo test >> a && cat a
# signals
# Ctrl-C: should cancel the current line and display a fresh promptAdjust based on your repository (typical folders:
src/,includes/,libft/, etc.)
src/source codeincludes/headersMakefile
- brturcio (École 42)
Implementación de un mini shell en C como parte del currículo de École 42. El objetivo del proyecto es comprender cómo funciona un shell real: parsing, ejecución de comandos, pipes, redirecciones, señales y variables de entorno.
- Prompt interactivo (modo terminal)
- Historial (si el proyecto usa
readline) - Ejecución de comandos usando
PATH - Builtins:
echo(con-n)cdpwdexportunsetenvexit
- Comillas simples y dobles (
'...',"...") - Expansión de variables (
$VAR,$?) - Pipes (
|) - Redirecciones:
>(truncate)>>(append)<(input)<<(heredoc)
- Manejo de señales (ej:
Ctrl-C,Ctrl-\) con comportamiento similar a bash
- Linux / macOS
make- Compilador C (gcc/clang)
- (Opcional)
readlineinstalado
makeEsto genera el ejecutable:
./minishell./minishellEjemplos:
minishell$ echo "hola mundo"
minishell$ ls -la | grep minishell > out.txt
minishell$ cat < out.txt- El proyecto busca replicar un subconjunto del comportamiento de bash.
- Se recomienda testear casos límite: espacios, comillas no cerradas, pipes consecutivos, redirecciones combinadas, etc.
Algunas ideas rápidas:
# variables
echo $HOME
echo $?
# pipes/redirecciones
ls | wc -l
echo test > a && cat < a
echo test >> a && cat a
# señales
# Ctrl-C: debería cancelar la línea actual y mostrar un nuevo promptAjustar según tu repo (carpetas típicas:
src/,includes/,libft/, etc.)
src/código fuenteincludes/headersMakefile