Skip to content

miketaonjo/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell – Unix Shell Implementation in C

Minishell is a Unix shell implementation written in C as part of the 42 School curriculum. It reproduces core Bash behaviors including command execution, pipelines, redirections, environment variable expansion, built-in commands, and signal handling. The project focuses on process management, file descriptor manipulation, parsing logic, and system-level programming concepts.

Overview

  • Language: C
  • Architecture: Modular parsing and execution pipeline
  • Process Handling: fork, execve, wait
  • Inter-process Communication: pipes
  • File Descriptor Management: dup2, redirections
  • Environment Handling: variable expansion and export management
  • Signal Handling: ctrl-c, ctrl-d, ctrl-\
  • Focus: Low-level Unix systems programming

Supported features

  • Prompt display
  • Command history (up and down arrows)
  • System executables available from the environment (ls, cat, grep, etc.)
  • Local executables (./minishell)
  • Builtin commands :
    echo (and option -n)
    cd (with only a relative or absolute path)
    pwd(no options)
    export (no options)
    unset (no options)
    env (no options or arguments)
    exit (with exit number but no other options)
  • Pipes | which redirect output from one command to input for the next
  • Redirections:
    >redirects output
    >> redirects output in append mode
    < redirects input
    << DELIMITER displays a new prompt, reads user input until reaching DELIMITER, redirects user input to command input (does not update history)
  • Environment variables (i.e. $USER or $VAR) that expand to their values.
    $? expands to the exit status of the most recently executed foreground pipeline.
  • User keyboard signals:
    ctrl-c displays a new prompt line.
    ctrl-d exits minishell
    ctrl-/ does nothing

However, Minishell does not support /, ;, &&, ||, or wildcards.

Installation

git clone <repository_url>
cd minishell
make

Usage

./minishell (anything from listed above)

Exemple

./minishell cat Makefile | grep o > out

About

A Unix shell implementation in C developed at 42 School. Supports pipelines, redirections, environment variable expansion and built-in commands with full process and signal handling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors