Skip to content

Latest commit

 

History

128 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by zotaj-di, baelgadi.

Minishell Badge

42 C

MiniDevil Banner

Description

MiniDevil is a POSIX inspired shell written in C as part of the 42 school minishell project.
It reads commands from the terminal, tokenizes & parses them into an AST (Abstract Syntax Tree) then executes the tree: handling pipes, redirections, environment variables and more, just like bash.

Showcase

MiniDevil Showcase

MiniDevil in action: pipes, redirections, heredoc and the UI mode

Quick start

git clone https://github.com/L3awdMan/MiniDevil.git
cd MiniDevil
make
./minishell

Want the extra UI mode (not in subject)?

./minishell --ui

Note

The cd builtin command is not supported through the UI.

Features

➤ Mandatory

  • Interactive prompt with command history (readline)
  • PATH based executable search and absolute OR relative path execution
  • Single and double quote handling:
    • ' prevents all interpretation
    • " allows for $ expansion
  • Redirections:
    • < (input)
    • > (output)
    • >> (append)
    • << (heredoc)
  • Pipes (|) connecting STDOUT to STDIN across commands
  • Environment variable expansion ($VAR, $? ...)
  • Signal handling:
    • CTRL C (new prompt)
    • CTRL D (exit)
    • CTRL \ (ignored)
  • Builtins: echo, cd, pwd, export, unset, env, exit

➤ Bonus

  • && and || operators
  • Parentheses () for subshell
  • Wildcard * globbing (in the current directory)

Instructions

➤ Requirements

Note

libft is vendored under ./libft/ and builds automatically as part of make — no manual setup needed.

  • GCC or CC compiler
  • GNU Make
  • readline library (libreadline-dev on Debian/Ubuntu)

➤ Build

make          # builds the mandatory part
make bonus    # builds the bonus part

➤ Run

./minishell

# UI Mode (extra, not in subject)
./minishell --ui

➤ Clean

make clean    # remove object and dependency files
make fclean   # clean + remove binary
make re       # full rebuild

Architecture

➤ Mandatory

Mandatory pipeline

➤ Bonus

Bonus pipeline

Further information is provided in the documentation.

Documentation

Caution

The explanations in this repository are not intended to encourage cheating or any behavior that goes against 42's rules. Their purpose is to support the peer-to-peer learning system. Bader and I do not encourage, support, or take responsibility for any form of cheating related to this repository.

Important

If you have read our explanations carefully, you will understand that they are not enough on their own .. you still need to do your own research.

Resources

➤ AI usage

AI tools (Claude) were used during this project for:

  • Debugging assistance and code review
  • Better understand core concepts and some edge cases
  • Acting as a rubber duck colleague (making sure the Doxygen comments and pages were understandable and accurate)
  • Greatly improved documentation by helping correct and refine it (Doxyfile & Doxygen xml/css/shell script)
  • Helping structure the bonus architecture in an efficient way

Authors

About

A Unix shell built from scratch in C, similar to Bash/POSIX; featuring command parsing, pipes, redirections, environment variables, signals, and built-in commands.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages