Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minishell (École 42)

English · Español


English

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.

Features

  • Interactive prompt (terminal mode)
  • Command history (if using readline)
  • Command execution through PATH
  • Builtins:
    • echo (with -n)
    • cd
    • pwd
    • export
    • unset
    • env
    • exit
  • 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

Requirements

  • Linux / macOS
  • make
  • C compiler (gcc/clang)
  • (Optional) readline installed

Build

make

This generates the executable:

./minishell

Usage

./minishell

Examples:

minishell$ echo "hello world"
minishell$ ls -la | grep minishell > out.txt
minishell$ cat < out.txt

Implementation notes

  • The project aims to replicate a subset of bash behavior.
  • Make sure to test edge cases: spacing, unclosed quotes, consecutive pipes, combined redirections, etc.

Testing

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 prompt

Project structure

Adjust based on your repository (typical folders: src/, includes/, libft/, etc.)

  • src/ source code
  • includes/ headers
  • Makefile

Author

  • brturcio (École 42)

Español

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.

Features

  • Prompt interactivo (modo terminal)
  • Historial (si el proyecto usa readline)
  • Ejecución de comandos usando PATH
  • Builtins:
    • echo (con -n)
    • cd
    • pwd
    • export
    • unset
    • env
    • exit
  • 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

Requisitos

  • Linux / macOS
  • make
  • Compilador C (gcc/clang)
  • (Opcional) readline instalado

Instalación / Build

make

Esto genera el ejecutable:

./minishell

Uso

./minishell

Ejemplos:

minishell$ echo "hola mundo"
minishell$ ls -la | grep minishell > out.txt
minishell$ cat < out.txt

Notas de implementación

  • 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.

Testing

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 prompt

Estructura del proyecto

Ajustar según tu repo (carpetas típicas: src/, includes/, libft/, etc.)

  • src/ código fuente
  • includes/ headers
  • Makefile

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages