Skip to content

leite-tiago/Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐚 minishell

minishell is a minimal Unix shell implemented in C as part of the 42 curriculum. It replicates core features of Bash, including command parsing, execution, environment variable handling, and redirections. This repository contains the mandatory part of the project and optionally includes bonus features.


πŸ’» How It Works

  • Displays a prompt and waits for user input.
  • Parses and executes commands with arguments.
  • Handles built-in commands like cd, echo, and export.
  • Supports piping, redirections, and environment variables.
  • Implements signal handling to behave like Bash.

πŸ“‹ Features

Mandatory

  • Custom prompt and command input via readline.
  • Built-in commands:
    • echo [-n]
    • cd [path]
    • pwd
    • export
    • unset
    • env
    • exit
  • Redirections:
    • Input <
    • Output >
    • Append >>
    • Here-document <<
  • Piping (|) between commands.
  • Environment variable expansion ($VAR, $?).
  • Proper signal handling (ctrl-C, ctrl-D, ctrl-\).

πŸš€ Getting Started

Prerequisites

  • Unix-like OS (Linux or macOS).
  • GNU Readline library.

Installation

  1. Clone the repository:

    git clone https://github.com/leite-tiago/minishell.git
    cd minishell
  2. Compile the project:

    make
  3. Run the shell:

    ./minishell

πŸ“‚ File Structure

minishell/
β”œβ”€β”€ include/            # Header files
β”œβ”€β”€ src/                # Source code
β”‚   β”œβ”€β”€ main.c          # Entry point
β”‚   β”œβ”€β”€ exec/           # Command execution
β”‚   β”œβ”€β”€ parser/         # Parsing logic
β”‚   β”œβ”€β”€ builtins/       # Built-in commands
β”‚   β”œβ”€β”€ signals/        # Signal handling
β”‚   β”œβ”€β”€ env/            # Environment management
β”œβ”€β”€ libft/              # Custom standard library (if used)
β”œβ”€β”€ Makefile            # Build instructions
└── README.md           # Project documentation

πŸ› οΈ Built With

  • GNU Readline - For interactive input.
  • C (following the Norm coding standard).

πŸ“– Future Improvements

  • Advanced wildcard and globbing support.
  • Job control (fg, bg, jobs).
  • History persistence across sessions.

✨ Acknowledgments

This project is part of the 42 Network curriculum. Grateful to the 42 community for collaboration and support.


πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

🐚 Minishell β€” This project is about creating a simple shell. Yes, my very own little Bash. Made me gain extensive knowledge about processes and file descriptors.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors