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.
- 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
- Parsing and lexing function (
- 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
- Setup and call
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
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.