GithubHelp home page GithubHelp logo

batuhantanir / minishell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from whymami/minishell

2.0 0.0 0.0 264 KB

Minishell is a project developed as part of the curriculum at 42 School. It aims to deepen understanding of process management and shell functionality.

C 97.13% Makefile 2.87%

minishell's Introduction

Minishell

As beautiful as a shell

Overview

Minishell is a project designed to create a simple, custom shell in C, closely mimicking the functionality of Bash. The project focuses on understanding processes, file descriptors, and various shell operations. This README provides a detailed guide on the structure, functionality, and usage of the Minishell project.

Table of Contents

  1. Introduction
  2. Features
  3. Installation
  4. Usage
  5. Built-in Commands
  6. Acknowledgments

Introduction

The existence of shells is linked to the very existence of IT. Initially, developers used aligned 1/0 switches to communicate with computers, which was quite cumbersome. The invention of shells allowed interactive command-line communication in a language closer to human language. With Minishell, we revisit the fundamental problems faced before modern GUIs and sophisticated shells like Bash.

Features

Minishell includes the following features:

  • Display a prompt while waiting for a new command.
  • Maintain a working history of commands.
  • Search and execute the correct executable based on the PATH variable or using a relative/absolute path.
  • Handle single and double quotes to manage metacharacters.
  • Implement input (<), output (>), append (>>), and here-document (<<) redirections.
  • Support pipes (|) to connect the output of one command to the input of another.
  • Manage environment variables and special parameter $? for the exit status of the most recently executed foreground pipeline.
  • Handle ctrl-C, ctrl-D, and ctrl-\ signals as in Bash.
  • Built-in commands: echo, cd, pwd, export, unset, env, and exit.

Installation

To install and run Minishell, follow these steps:

  1. Clone the Repository

    git clone <repository-url>
    cd minishell
  2. Build the Project

    make
  3. Run Minishell

    ./minishell

Usage

Once Minishell is running, you can use it similarly to Bash:

  • Basic Commands

    ls -l
    echo "Hello, World!"
  • Redirections

    cat < input.txt
    echo "New content" > output.txt
    echo "Append this" >> output.txt
    cat << EOF
    > This is a
    > here-document example
    > EOF
  • Pipes

    ls -l | grep minishell
  • Environment Variables

    echo $HOME
    echo $?
  • Signal Handling

    • ctrl-C: Displays a new prompt on a new line.
    • ctrl-D: Exits the shell.
    • ctrl-\: Does nothing.

Built-in Commands

Minishell implements several built-in commands:

  • echo

    echo -n "No newline"
  • cd

    cd /path/to/directory
  • pwd

    pwd
  • export

    export VAR=value
  • unset

    unset VAR
  • env

    env
  • exit

    exit

minishell's People

Contributors

emiryasa avatar batuhantanir avatar whymami avatar halukozdemir avatar fygen avatar

Stargazers

 avatar aepContainer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.