Rshell, much like Bash, is a program that takes in the user input commands and executes them. In fact, Rshell is a more user-friendly version of Bash with some modifications and limitations. Please see the Uses and Specifications section first to understand how Rshell interprets commands from the user and how to use it effectively. Then please see the Bugs, Limitations, and Errors section to see what my program cannot support or properly carry out.
All bugs, errors, fixes, or modifications can be sent to [email protected]. Reported bugs and errors will be handled as soon as possible and submitted for correctness. Modifications will be implemented based on evaluations of effectiveness.
To get Rshell and run it, please open up a terminal and run these commands:
git clone https://github.com/ykamo001/rshell.git
cd rshell/
make
bin/rshell
-
To exit Rshell, simply enter in the command
exit
whenever you wish to exit. -
Supports the connectors
;
&&
and||
.- Commands separated by
;
will be executed regardless of whether the previous command was successful or not. - Commands separated by
&&
will only execute if the last command was successful. - Commands separated by
||
will only execute if the last command failed.
An example of precedence:
ls -a && rmdir folder || mkdir new_folder; touch main.cpp; mv main.cpp new_folder
Rshell will interpret this command as such:
(ls -a && rmdir folder) || (mkdir new_folder); touch main.cpp; mv main.cpp new_folder
Thus only if both
ls -a
andrmdir folder
are successful willmkdir new_folder
not execute, otherwise if any of the first two fail, a new directory called "new_folder" will be made. As for the next two commands, they will execute regardless of whatever happened before. - Commands separated by
-
Anything typed after the comment identifier
#
will not be registered as commands and will be considered as comments.An example of how Rshell interprets comments:
ls -a && touch file.cpp #anything I type now will not be executed; cat file.cpp; exit
Rshell will filter out this command to:
ls -a && touch file.cpp
, and thus literally everything after the#
does not get recognized by Rshell as a command. If you must write comments, please do so at the very end of you entire command line, as such:ls -a && touch file.cpp ; cat file.cpp; exit #anything I type now will not be executed
-
Rshell does not differentiate between
&&
and&
, and between||
and|
. -
Rshell does not support i/o command such as
echo "Hello World" >> file.cpp
and will cause the program to terminate and crash. -
After pressing
ctrl-z
, Rshell will stop properly and be pushed to the background; however, after returning to Rshell by usingfg
, Rshell will not output a command line or prompt, but it is still running; pressenter
once to see prompt. -
If accidentally inserted more connectors, such as
&&&&&
or||||||
, Rshell will interpret this as a user mistake and consider them as&&
and||
, respectively. -
When using
echo
, if connectors are combined improperly with other connectors or symbols, such as:echo hello &| echo world
orecho hello &\ echo world
will cause the program to terminate and crash. -
You will be able to recursively call Rshell within Rshell, resulting in multiple Rshells running Rshells. Executing the
exit
command will simply make you exit the current Rshell you are running; therefore, if you ran Rshell, then ran Rshell again, and ran Rshell one more time, in order to exit Rshell completely, you would need to executeexit
, followed byexit
, now placing you in the initial Rshell you called, and finally executingexit
one last time. This can lead to Rshell-ception and is not recommended, as you can easily lose track of which Rshell you are in.
-
Running
ls
with the-l
and/orR
flag may cause unexpected output ofdo_ypcall: clnt_call: RPC: Unable to send; errno = Operation not permitted
to randomly appear. Program will still run and output everything as expected, except this, too, shall be there. -
ls
cannot output the files, directories, executables, and hidden files with specific colors. -
If any error is occurred with any directory or file,
ls
will terminate and output a specific error message indicating where things went wrong. -
If there is a soft link to another file, when running
ls -l
there will be no indication of which file it points to, i.e. you will not see the output of-> filename
.
-
Solely for I/O redirection, order of commands entered will not matter. Program will effectively separate inputted command and execute all input redirection first, i.e
<
, then will implement all output redirection, i.e>
, and finally run all>>
commands. This may, depending on the inputted command, cause result to be not as expected or executed like bash. -
Adding excessive white-space in the command will increase the chances of the program NOT crashing or producing error.
-
The command
echo < file1 file2 file3
will definitely cause the program to abort and produce errors. This can be fixed by placing any extra amount of white-space anywhere in the command afterecho
and beforefile3
. If any command causes program to abort, using more white-space may fix error. -
Running the command
cat > file1
will land you in an infinite loop to enter whatever you like to be put intofile1
, and can be ended byctrl+c
, but will also causershell
to terminate. -
Running big commands will cause program to produce memory map error and may abort, depending on the length and command.
-
Piping and I/O both use extensive heap allocation and may cause memory errors to occur.
-
If an I/O command fails, then it will not execute any command connector by
||
, the program will think it is a success; therefore even if an I/O command failed, it will go on to execute the commands connected by&&
, as it is a success. -
Adding comments to the I/O command line will cause program to terminate, but is not affected in piping stand-alone, or if I/O is implemented with piping.
-
^C
while in use ofcat
will also append an empty line to the end of the file -
^C
with big, complex commands might cause zombie processes to remain while runningrshell
-
^Z
will sendrshell
to the background