rshell is a C++ application that simulates a terminal's shell. It executes commands, creates, overrides, and deletes files, and even runs programs, as if you are still using your terminal!
Note: If you are using Ubuntu, you may need to install the GNU C++ compiler package in order to generate the executable. There are two known ways to do this:
-
Type in your terminal:
sudo get-apt install g++ -
Find the package under your OS version from this link. Then download it and follow the instructions on installation.
Running this software requires only 5 steps using your terminal:
git clone https://github.com/aesgu001/rshell.git
cd rshell
git checkout hw3
make
bin/rshell
-
Input/Output Redirection: This shell can now read from an existing file with the
<operator, and write to a new or existing file by either truncating>or appending>>. Note, however, that it can only do 1 input and/or 1 output redirection, and only the rightmost redirection arguments will be passed in per command. -
Piping: Piping is now implemented into this shell, allowing information from a previous command to be passed in to the next one. It can pipe two or more commands.
-
Change Directory: The new
cdcommand feature allows the user to work under more than one existing directory. The shell's prompt also displays the current working directory. -
Interrupt Signal: The interrupt signal or
^Cnow returns the user to the shell's prompt, cancelling commands without the shell exiting itself! -
Stop Signal: The stop signal or
^Znow stops a child process, and stores it in a stack, where it shall either be resumed or terminated by the user. Thefgandbgcommands are also implemented to resume the most recently stopped child process either in the foreground or in the background.
-
Entering
bin/rshellin the shell simulator runs a duplication of the application. Returning to the bash shell would require you to enterexitexactly the number of times you enter the previous command. -
The
echocommand will include quotation marks when printing quoted arguments. -
The
git commit -m <message>command will not be executed successfully. -
Appended redirection operators will not perform redirection.
-
Redirection operators passed in first per command will be recognized as executables, which will not be executed successfully.
-
Any output redirection will be ignored should any input redirection fail in one command.
-
Piping commands without operands, such as
ls -r |, will be treated as a syntax error. -
Any child process will automatically be terminated by the
^Csignal, stopped or running. Interrupting running child processes in the background will display the shell prompt in a disorderly manner. -
The built-in stack data structure can store more than one stopped child process, but only the top child process may continue by entering
fgorbg, since the only way to terminate it is by sending the^Csignal. -
Killing a stopped child process using
kill -9will print the shell prompt in a disorderly manner. "Resuming" a killed child process will exit the shell. -
Resuming child processes in the background will not be stopped if they are trying to read from the shell's standard input.
-
Without the
-lflag,lsonly separates the files by spaces. -
Texts of hidden files do not have a grey background.
-
Running
bin/ls -R -aon heavy directories, like.git, will most likely fail due to a syscall error. -
Number flags do not return an error.
-
-lflag may format unequal spacing due to the number of hard links for each file.