CMPE322 PROJECT #1: Implementation of Your Own Shell solved


Category: You will receive a download link of the .ZIP file upon Payment


5/5 - (1 vote)

1. Introduction
In this project, you are going to implement your own shell (i.e Command Line Interpreter) which is
composed of a set of certain commands. The functionalities of these commands are already available
within the default shell of your Linux-based OS. However, it is desired to implement a customized shell
so that we can easily remember the commands and their corresponding functionalities.
For example, even though you are experienced programmers and you know which command does
which operation, it may be difficult to relate “ls” command to list the contents of the current directory.
If the name of the command that provided this operation was “listdir”, life would be easier for the
The aim of this project is developing a program to achieve the aforementioned objectives. You have
to implement your project on a Linux-based platform by using the GCC/G++ compiler. Your code
will be tested on a Linux machine, so that you can consider these requirements as mandatory, not
optional. It is allowed to use C or C++ of the main programming language of the project
2. Details of Implementation
The shell program will be executed as a typical C/C++ program compiled via the terminal. In other
words, it is not expected in this project that your shell program will automatically become active after
opening a new terminal window by setting your shell program as the default shell through various
settings on the system.








and the program starts to wait for another command after the command is successfully completed.
Your Shell program will continue to run until the interrupt signal or the “exit” command is entered.
Here is the list of commands that should be available on your shell program (Note: The shell should
take an input command from the user after putting a single space following the “>>>” sequence, as
shown in the example usage below):
● listdir
○ This command will print out the contents of the current directory, same as the “ls”
command in bash.
○ Example usage: >>> listdir
● mycomputername
○ This command will print the given name of the used device.
○ Example usage: >>> mycomputername
● whatsmyip
○ This command will print out the current ip adress.
○ Example usage: >>> whatsmyip
● printfile (fileName)
○ This command will take a file name as an argument, read its content and write them on
the standard output, line by line. User should press enter to progress.
○ Example usage: >>> printfile myText.c,
● printfile (fileName) > (newFileName)
○ This command will take a file name as an argument, and redirect the standard output
to a new file using the redirection operator, >, (greater than symbol).
○ Example usage: >>> printfile myText.c > myTextNew.c
● dididothat
○ This command will simply search a simple command in up to maximum 15
commands that are executed before. The output will be a simple “Yes” or “No”.
○ Example usage: >>> dididothat “whatsmyip”
A similar functionality is provided by the “history” command in most of the shells.
● hellotext
○ This command will open the default text editor. However, when the text editor is
closed, user should be able to continue using this shell.
○ Example usage: >>> hellotext
● exit
○ Your shell process will be terminated after the user enters the exit command.
○ Example usage:>>> exit







Your shell implementation should only consist of the set of commands that are presented above. The
combinations that are not discussed will not be tested or evaluated.
The implementation details are up to you. You can use your own design as long as it provides the
necessary functionalities.
3. Submission Details
● You need to upload a .zip file on Moodle until the deadline specified at the top of this document
Important note: No .rar files or other extensions are accepted.
● Here is the late submission policy. If you submit within following 24 hours after the deadline,
there will be 20 points penalty. For another 24 hours will result in 30 points more penalty.
No submissions will be accepted after the second day of the late submission.
● This is an individual assignment; no group submission is allowed. Plagiarism policy of the
course applies for this project, which means that your code will be analyzed for plagiarism.
No excuses will be accepted.
● The name of the zipped file should be [StudentID].zip without the brackets (e.g.,
“”). The files that must be included in the zipped file are:
○ Code files (C or C++)
○ A Makefile that creates an executable (optional bonus)
● You should document your code. You don’t need to create an extra file for the documentation,
your code should be commented as the documentation.
● Here is the grading policy:
○ Coding and implementation (90%)
○ Code documentation (10%)
● If you conflict with any provided rules in this section, it will negatively affect your grade.
● Good luck!