Code Monkey home page Code Monkey logo

minishell's Introduction

This is a 21 School/Ecole 42 Project. Worked in team with Cflorind

minishell

Coding a simple CLI shell with basic functionality. Subject can be found here.

Project goals

  • Understand the way shells work
  • Implement redirections, pipes, handle environment variables
  • Practice signal handling
  • Implement list of builtins

Preview

Features

Basics:

  • History of previous 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 * in the current working directory
  • 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
  • | connect cmds or groups with pipes; output of a cmd is connected to the input of the next cmd via a pipe
  • && and || with parenthesis for priorities

Builtins:

  • echo with option -n
  • cd
  • pwd without options
  • export without options
  • unset without options
  • env without options
  • exit [exit_status] without options

Redirections:

[n] (optional) specifies the file descriptor, if not specified it is stdout/stdin

  • [n]< file Redirecting Input
  • [n]<< limiter Here Documents
  • [n]> file Redirecting Output
  • [n]>> file Appending Redirected Output

To compile and run

Run the following commands in Terminal:

# to build
> make

# to run
> ./minishell 

minishell's People

Contributors

rarakira avatar splinehip avatar

Stargazers

 avatar  avatar  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.