Skip to content
VolmerESPublic

About

A bash-like shell in C: pipes, redirections, heredoc, environment variables, signals and built-ins · 42 Madrid

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

421 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell

42 Cursus C

🗣️ About

Minishell is a shell written in C as a team project of the 42 Madrid common core (grade: 100/100). It provides a basic command-line interface where users can execute commands and interact with the operating system, mimicking the behavior of bash.

✨ Features

  • Command Execution: Runs external programs from PATH and the built-ins echo, cd, pwd, export, unset, env and exit.
  • Redirection: Handle input (<, <<) and output (>, >>) redirections.
  • Pipes: Chain multiple commands using pipes (|).
  • Environment Variables: Manage environment variables with export and unset, and expand them with $.
  • Signal Handling: Ctrl+C, Ctrl+D and Ctrl+\ behave as they do in bash.
  • Command History: Previous commands with the arrow keys, through readline.

🏗️ Architecture

The parsing logic is a critical component of Minishell. The following diagram illustrates how the command line input is processed:

Parsing Diagram

🚀 Getting Started

Prerequisites

  • GCC or Clang
  • Make
  • Readline library

Installation

  1. Clone the repository:
    git clone https://github.com/VolmerES/Minishell.git
  2. Navigate to the project directory:
    cd Minishell
  3. Compile the project:
    make

🛠️ Usage

Run the shell:

./minishell

Examples

Execute commands:

minishell$ ls -l

Redirection:

minishell$ grep "error" < log.txt > errors.txt

Pipes:

minishell$ ps aux | grep minishell

Environment Variables:

minishell$ export MY_VAR="Hello World"
minishell$ echo $MY_VAR

Authors

About

A bash-like shell in C: pipes, redirections, heredoc, environment variables, signals and built-ins · 42 Madrid

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages