Skip to content

em1e/minishell

Repository files navigation

📖 Minishell

Description

Minishell is a recreation of bash, designed to help you understand how command-line interpreters work. With this shell, you can execute commands, handle piping (|), redirection (>), and environment variable management, mimicking the behavior of Bash. Additionally, it supports handling signals, handling exit commands, and more, making it a small but powerful shell.

This project provides a hands-on way to explore how a shell processes input, interprets commands, interacts with the operating system, and executes system calls.


minishell demo

Features

  • Command Execution: Execute basic commands such as ls, echo, cat, and more.
  • Pipes (|): Connect multiple commands via pipes to pass the output of one command as input to the next.
  • Redirection (>, >>, <): Redirect input and output between files and commands.
  • Environment Variables: Set and get environment variables like $PATH, $USER, etc.
  • Signals: Handle signals like Ctrl-C and Ctrl-D gracefully.
  • Customizable Prompt: Customize the shell prompt and the appearance of the shell.
  • History: Track and access previously run commands (optional feature, depending on your implementation).
  • Exit Command: Exit the shell with the exit command.

Compile and Run

Installation

  1. Clone the repository:
git clone <repository_url>
cd 42_minishell
  1. To compile the program, simply run:
make
  1. To run the program:
./minishell

Controls

Simply type a command and press Enter to execute it. Use Ctrl-C to interrupt the running command (handled gracefully in Minishell). Use Ctrl-D to exit the shell (end of input).

Example commands:

ls – List directory contents echo "Hello World" – Print the string Hello World to the terminal cat file.txt – Display contents of a file exit – Exit the shell

./minishell
minishell$ echo "Hello, World!"
> Hello, World!
minishell$ ls
> Documents  Downloads  Minishell  Pictures
minishell$ cat file.txt
> This is the content of file.txt.
minishell$ exit

About

A project about creating our own bash

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors