Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Phase 1

The premise of Project 2 is to create your own shell. Your shell will be launchable from a terminal window and act similar to the existing shell.

Groups:  You can work in groups of 1-3 people.  When you turn in the project, make sure every file has the names of everyone from the group.  If you email me the project, just email me the source files.  I will assign grades based on the member names in the source files!  If you want to author each function or section of code via comments to take credit for parts of the program that is fine, but everyone in the group will receive the same grade regardless of the division of labor.

The next two projects will be group projects based off of this project so choose your groups wisely.  You will be allowed to change groups between projects.  If a grad student groups up with undergrads, the project must include Part 6

Part 1

The prompt

Your shell will need to provide a prompt to the user.

46_create your own shell.png

an example of the windows command line prompt

The prompt will be able to display information to the user to provide them with information about their environment.  By default, your prompt should be include the Current Working Directory.You will need to implement a setprompt command in your shell.  An example of the setprompt would be:

setprompt %PWD%$

which then would display a prompt like:

/home/brian/$

Use %PWD% as a substitute for where to insert the current working directory for the prompt string.  After every command is run, you need to display the prompt string to ask for the next user input.

Part 2: 

Implement the "cd" command.  the CD command changes the current working directory of the process.  Your shell should be able to handle commands like the following:

/$  cd bin

          changes from / to /bin/, since we are currently in /

cd /

          changes from CWD to /

/$ cd home/bin

          changes from / to /home/bin, since we are currently in /

 

/home/brian/$ cd ..

          changes from /home/brian/ to /home/ (goes up one directory)

/home/brian/$ cd ../..

          changes from /home/brian/ to / (goes up 2 directories)

 

/home/brian/$ cd /tmp

          changes from /home/brian/ to /tmp/ since /tmp was specified from the root dir

Part 3:

dir command.

Your program will implement a dir command.  This command acts much like the ls  command within the normal linux terminal.  You cannot simply exec the ls command.  you will need to implement it via the opendir and readdir commands.

for example exeucting

/home/$ dir

would output a list of files each on its own line:

  .

  ..

  brian

  tamarra

  matt

  justin

Assuming the home directory contained entries for each of those people.

As arguments to dir you will need to handle:

-s=

          options: name, adate, type

The sort option will sort the results by the specified parameter before printing them out to the screen. (adate is date of last access, type is file type, name is filename)

-r

          recursive.  dir will output the files within the current working directory and every sub directory within, recursively entering deeper and deeper into the directory structure.

Example output:

/home/$ dir -r

  .

  ..

  brian

  tamarra

  matt

  justin

/home/brian/

  .

  ..

  workspace

  documents

  assignments

  tmp

/home/brian/workspace/

  .

  ..

  project1

  project2

  project3

 

/home/brian/documents/

  .

  ..

  lab1

  lab2

  lab3

  midterm

/home/tamarra/

  .

  ..

  projects

  documents

 

finally

-i

          displays a directory listing similar to ls -l, which outputs the files inside a directory with all their attributes.  Attributes must include at least:

          permissions, size, owner, group, access date, modified date, filename

flags can be combined!  so you could have something like

dir -s=name -r -i

which will sort files in a directory by name, and then recursively display detailed information for all files in the directory and all sub directories.  Order of options specified in the argument list can vary.  You could have -s -i -r or -i -r -s or -r -i -s etc.

Part 4

Redirection and piping.  Your shell will need to handle the redirect characters and the pipe character.  for example:

dir -s=name > dirout.txt

would perform the dir command, with the sort option and write the results to the file dirout.txt in the current working directory.

Part 5

Fork and Exec for other functionality.

Since I cannot have you completely rewrite all the tools available through the linux terminal, your shell will need to be able to fork and exec any command it doesn't recognize.  You should use the which command to determine if the entered programs actually exist before attempting to fork and exec.  Display an error if the commands do not exist. 

Your fork and exec must support redirection and piping as well.  I should be able to execute:

dir -i -r | grep cpp > allsourcefiles

Part 6

you will need to implement a cat function similar to the cat in the existing linux terminal.

cat file1 - file2

Output file1's contents, then standard input, then file2's contents to standard output.

cat

Copy standard input to standard output.

For simplicity sake, end the input from standard input when 2 newline characters are read back to back.

Conclusion and other thoughts

It would be nice to include an exit command to terminate your shell.  so if the user types in exit, quit your shell.

Also to be user friendly, you could store the users prompt value, so they wouldn't have to reset it every time they run the program.

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M9720087
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Operating System

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Briefly describe the following concepts and indicate how they are related in the context ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Consider a computer embedded in the control of a manned spacecraft. Would it require an ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

Question what do you see as the major differences between

Question : What do you see as the major differences between UNIX/Linux and other operating systems, such as Windows and Mac OS X? The response must be typed, single spaced, must be in times new roman font (size 12) and m ...

Catalog course descriptionin this course students carry out

Catalog Course Description In this course students carry out independent research in a significant technical area of information, network, and computer security. The student is to investigate a technical area, research i ...

Foundation of information technologyresearch types of

Foundation of Information Technology Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Expl ...

Question note apa format 250 words and three reference

Question: Note: APA format 250 words and three reference without plagarism Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use ...

Question you are a security administrator responsible for

Question: You are a security administrator responsible for providing secure configuration requirements for new laptop deployments. After reading Module 2 of Certified Secure Computer User v2exercises, apply the configura ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

Question students working at individual pcs in a computer

Question : Students working at individual PC's in a computer laboratory send their files to be printed by a server that spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As