Skip to content

apham024/rshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RSHELL

This is a command shell. Programmed in C++ and makes use of execvp, waitpid, and fork.
Has the same functionality as a regular terminal.

Introduction

We will be creating a project that allows us to take in commands from the command line in bash and we will be using connectors to execute them. By using a composite design pattern consisting of Connector class as the composite and a command class as a leaf, we are able to accomplish this

";" = The following command will always be executed.
"||" = If the current command fails, the following command will be executed.
"&&" = If the current command succeeds, the following command will be executed.
"#" = Everything after "#" will be a comment.
"[]" = Symbolic version of the command "test".
"()" = Used to change the precedence of the returns of commands, connectors, and chains of connectors.

Can support commands such as

"exit" = Will exit the entire command line and program.
"mkdir" = Creates a directory from the terminal.
"pwd" = Displays the pathname of the current directory.

Can support the following flags

-e checks if the file/directory exists
-f checks if the file/directory exists and is a regular file
-d checks if the file/directory exists and is a directory

Install Instructions

$ git clone https://github.com/apham024/rshell.git
$ cd rshell
$ git checkout hw4
$ make
$ bin/rshell

Authors

Annie Pham
Sabrina Wong

Bugs/Limitations

Cannot 'cat' if file is empty; 'cat' does somewhat work with something in the file
Currently outputs an error when 'cat' is used