Assignment Chef icon Assignment Chef

[Solved] COMP304 Project 1-seashell Your Custom Shell

5.0 1 customer review Digital download

Digital download

$25.00

Availability
In stock
Checkout
One item

Need a hand?

Message us on WhatsApp for payment or download support.

WhatsApp QR code
This project aims to familiarize you with the Unix system call interface and the shell by letting you implement several features in a shell, called seashell, using C/C++. A shell is a program that provides interface to the operating system by gathering input from the user and executing programs based on that input. Once executed, the seashell will read both system and user-defined commands from the user. The projects has six parts:

Part I

Part II

(10 points) shortdir: In this part, you will implement a new command, shortdir, to associate short names with the current directory. The purpose is to reach the directory (change 1 Part III to the directory) with a short name instead of typing the whole path. For instance, we associate the name matlab with the directory /usr/local/MATLAB/R2018b/ and use it to change to that directory by using the name matlab. You will also implement supportive options for the shortdir as follows: Note that this command lives across shell sessions; when a new shell session is started, it should remember the associations from the previous sessions. Refer to Listing 1 for sample usage of shortdir. Listing 1: Setting alias for a directory using shortdir
seashell> pwd/usr/local/MATLAB/R2018b seashell> shortdir set matlabmatlab is set as an alias for /usr/local/MATLAB/R2018b/ seashell> shortdir jump matlab seashell> pwd/usr/local/MATLAB/R2018b
1 2 3 4 5 6 7 8

Part III

highlight: In this part, you will implement the highlight command that takes a word-color pair and a text file as an input. For each instance of the word appearing in the text file, the command prints the line where the word appears and highlights the word with that color. The colors can be one of the r (red), g (green) or b (blue) colors. The word check is not case-sensitive. The command syntax and its sample usage are as shown below: seashell> highlight <word> <r | g | b > <filename> seashell> highlight language r file.txt The programming language used for this code is C. The first three letters of English language are A B and C. Part IV

Part IV

In this part of the project, you will implement a new seashell command, goodMorning: Listing 2: Sample usage of goodMorning command
seashell> goodMorning 7.15 /home/musics/muse.mp3
1 Before implementing the new command inside seashell, you should get familiar with crontab (if you decide to use crontab) and rhythmbox on a regular shell. More info about rhythmbox: http://manpages.ubuntu.com/manpages/hardy/man1/rhythmbox-client.1.html More info about crontab: http://www.computerhope.com/unix/ucrontab.htm

Part V

In this part, you will implement the kdiff utility to compare two files in given paths. Sample usage of kdiff to compare two files is given in Listing 3. The utility will operate in two modes: If the user does not provide either a or b, a is assumed by default. Note: You are not allowed to use existing file comparison tools (such as diff) to compare the files. We expect you to use C/C++ file I/O operations to complete this task. You may use the existing tools to verify your output. Listing 3: kdiff utility sample output
seashell> kidff -a file1.txt file2.txtThe two text files are identical
1 2 3 Part VI
seashell> kdiff -a file1.txt file2.txtfile1.txt:Line 23: A quick brown fox jumps over the lazy dog file2.txt:Line 23: A swift squirrel climbs the tree file1.txt:Line 41: Corona cases today = 1200 file2.txt:Line 41: Corona cases today = 6892 different lines foundseashell> kdiff -a file.txt file2.txt The two files are identicalseashell> kdiff -b file1.bin file2.bin The two files are identicalseashell> kdiff -b file1.bin file21.binThe two files are different in 8213 bytes
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Part VI

In this final part, you will implement a command of your choice in seashell. Come with a new, non-trivial command and implement it inside seashell. Creativity will be rewarded and selected commands will be shared with your peers in the class. It is possible that command you come up with is already implemented in Unix. That should not stop you from implementing your own but do not simply execute the existing Unix version of it.