Coder Social home page Coder Social logo

rshell's Introduction

Project Created By:

  • Se Hoon Bang
  • Kenneth Siu

rshell

rshell is a shell used to run commands and connectors

Features

Executables

Run any comands, besides cd, such as ls, pwd, echo, etc.
e.g.: ls will list the contents of the current directory Run "exit" to exit rshell.

Connectors

Use connectors, such as ||, &&, and ; to connect commands however you like.
e.g.: (a && b || c) will run ((a && b) || c) instead of (a && (b || c)))

Comments

Use # to commment out any part of a command.
e.g.: echo hello world # hello world is printed, but this is not!

Implementation

The project consisted of several steps.
  • We got the user input using getline, and parced it into three different vectors - executables, arguments, and connectors.
  • We called execvp with the executable (and argument) as parameters.
  • We checked whether or not the executable (and argument) was valid and if it was, ran it.
  • We had a function to check whether or not the next executable should be run depending on the connectors.
  • We had another function which calculates the proper grouping of commands. (e.g.: if we ran a && b || c, it should run ( (a && b) || c ) instead of ( a && (b || c) )).
  • We put the whole thing into a while loop so that it would run unless the executable entered is "exit" in which it would then exit the rshell.
  • We tested the rshell by outputting our expected output, followed by outputting our actual output.

Possible Bugs & Future Updates

The cd command has not been implemented.

rshell's People

Contributors

sbang002 avatar

Watchers

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