Skip to content

garyhtou/Simple-Multiprocessing-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐚 [myshell] A Simple Shell with Multiprocessing and Pipes

About

myshell is a simple shell (command-line interpreter) capable of handling one command (with or without pipes).

It reads a single line from the stdin, lexes it, then executes it via execvp.

More information can be found here.

Team members and contribution

  • Gary Tou (@garyhtou)
    • Parsing and lexing function (Helper::lex) that also handles quoted strings
    • File descriptors and forking
    • Object orientated Command class for more organized code
  • Castel Villalobos (@impropernoun)
    • Makefile
    • Handle difference between single vs multi-command
    • Set up pipes
  • Hank Rudolph (@hankrud)
    • Setup and call execvp
    • Convert C++ string to c string
    • Prompt and get input

Strengths and Weaknesses

Strength:

  • Handles quoted strings. eg. echo "it works on my machine"
  • Object orientated design (See Command class)
  • Able to handle "unlimited" commands and arguments (not restricted to the 10 commands and 20 arguments per command requirement from the instruction)
  • Well commented

Weaknesses:

  • Shell does not run continuously
  • Does not handle changing operators such as &&, ||, and ; (it does handle |)
  • Does not handle environment variables

The program is composed of three files:

  • myshell.cpp: Contains the main function and handles the coordination of multiple commands and pipes.
    • Gets the inputted command and parses and lexes it.
    • Then runs it as either a single command (no pipes) or multi-command (with pipes).
  • command.cpp: Responsible for executing the commands and managing pipe file descriptors.
  • helper.cpp: Contains functions that parses and lexes commands into tokens, as well as handles whitespace.

About

A simple shell featuring multiprocessing and pipes

Topics

Resources

Stars

Watchers

Forks