rshell
imitates the functionality of a terminal. rshell
performs the following steps:
- Print the command prompt
userName@hostName $
- Read in a command on one line. Commands can be separated by connectors.
- Connectors include
&&
,||
, and;
.
- Connectors include
- Execute the line of commands
- If a command is followed by
;
, then the next command (if any) is always executed. - If a command is followed by
&&
, then the next command is executed only if the first one succeeds (returning true). - If a command is followed by
||
, then the next command is executed only if the first one does not succeed (returning false). - Anything found after the first found
#
is considered a comment and will be ignored.
- If a command is followed by
- Commands with more than 2 but less than 7 flags will not execute.
echo
with quotes will include quotes in output.
In addition to hw0 functionality, rshell
can now perform the following:
- Input redirection (< and <<<)
- Output redirection (> and >>)
- Pipes (single and chained)
- single and double quotes are always included in string inputs
- Cannot pipe with input redirection
In addition to hw0 and hw2 funcionality, rshell
can now perform the following:
- prompt also displays the current working directory
- the home folder is replaced with a
~
for readability
- the home folder is replaced with a
cd <PATH>
which will change the current working directory tocd
which will change the current working directory to the home directorycd -
prints an error if OLDPID is not set^C
does not existrshell
. The current foreground job receives theSIGINT
signal instead. This kills the job, and control is returned torshell
.
cd -
does not change the current working directory
ls
implements a subset of the GNU ls
command:
- It can support the -a, -l, and -R optional flags; and the ability to pass in one or many files optional.
- It also displays different types of files in different colors that can be combinable
- directories are blue
- executables are green
- hidden files have a gray background
- Files are listed in alphabetical order from left to right, then top to bottom.
- Columns are all of equal width.
- Sometimes outputs an unnecessary endl.
$ git clone https://github.com/jle034/rshell.git
$ cd rshell
$ git checkout hw3
$ make
$ bin/rshell
$ git clone https://github.com/jle034/rshell.git
$ cd rshell
$ git checkout hw1
$ make
$ bin/ls