Giter Site home page Giter Site logo

minishell's Introduction


Logo

Minishell

As beautiful as a shell
Report Bug ยท Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Features
  5. License

About The Project

Subject PDF

This is the first group project of the 42 core curriculum. The objective of this project is to create a simple bash-like shell. There were specific Project specifications, like only being allowed to use a few low-level functions and POSIX system calls. If you want to know more about the requirements, take a look at the Subject PDF. This project was done in collaboration with Florian Bindereif

(back to top)

Getting Started

The Project was mainly tested on macOS, but it should work on all UNIX/LINUX based systems.

Prerequisites

To run the Minishell, you need to install the readline library first, which can be done like this:

brew install readline

Or

apt-get install libreadline-dev

Installation

  1. Clone the repo
    git clone https://github.com/42sin/minishell.git && cd minishell
  2. Change the readline path inside of the Makefile, you can see your path with brew info readline
    -I/usr/local/opt/readline/include
    -L/usr/local/opt/readline/lib
  3. Compile the project
    make
  4. Run the minishell
    ./minishell

(back to top)

Usage

You can use the minishell as you would use any other Shell to execute commands. We handled a lot of unnecessary things that were not specifially required by the Subject, which you can read more about in Features

Here is an example of a basic command using some of the control operators.

This is a more advanced example where you can see the implementation of Here Documents, the variable used as a delimiter isn't expanded but the ones used inside of the Here Document are expanded.

(back to top)

Features

Basics:

  • History of previously entered commands
  • Search and launch the right executable (based on the PATH variable, using a relative or an absolute path)
  • Environment variables ($ followed by a sequence of characters) expand to their values
  • Wildcards *
  • Ctrl-C, Ctrl-D, and Ctrl-\ behave like in bash
  • โ€™ (single quotes - prevent from interpreting meta-characters in quoted sequence)
  • " (double quotes - prevent from interpreting meta-characters in quoted sequence except for $)
  • $? expands to the last exit status
  • | Output of a command is connected to the input of the next Command
  • && and || with parenthesis for priorities

Builtins:

  • echo with -n
  • cd (relative or absolute path, ~ for HOME)
  • pwd
  • export without arguments or with a new environment variable to be set
  • unset
  • env
  • exit [exit_status]

Redirections:

  • [n] < file Redirecting Input
  • [n] << limiter Here Documents with environment variable handling
  • [n] > file Redirecting Output
  • [n] >> file Appending Redirected Output

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

minishell's People

Contributors

42sin avatar

Watchers

 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.