Phase 1the premise of project 2 is to create your own shell

Assignment Help Operating System
Reference no: EM13350470

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=<option>

          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.

Reference no: EM13350470

Questions Cloud

Leadership reflections paper write a paper that includes : leadership reflections paper write a paper that includes four sections thata summarizes and reflects upon leadership
Review the scenarios from the steven pinkers article : review the scenarios from the steven pinkers article devised by jonathan haidt. why those scenarios are considered so
-analyze the usa financial meltdown that happened in : -analyze the usa financial meltdown that happened in 2008-2009. this crisis was partially caused by the reward systems
Jetblue is a discount airline in the united states that has : jetblue is a discount airline in the united states that has been successful in a tough industry. your assignment is to
Phase 1the premise of project 2 is to create your own shell : phase 1the premise of project 2 is to create your own shell. your shell will be launchable from a terminal window and
The purpose of this assignment is to provide you the : the purpose of this assignment is to provide you the opportunity to relate the concepts that we have been emphasizing
Part-11 suppose you want to demonstrate an erd to someone : part-11. suppose you want to demonstrate an erd to someone who has never seen one. provide a scenario from everyday
Case 1mg is an 8-year-old boy who has been brought to the : case 1m.g. is an 8-year-old boy who has been brought to the emergency department by his parents with a fever of
Question 1in an investment policy statement the objectives : question 1.in an investment policy statement the objectives of an investor are expressed in terms ofa.nbsp risk and

Reviews

Write a Review

Operating System Questions & Answers

  Validating the option code field during data entry

The systems reviewer are constructing the test plans for the user interface for the Holloway Travel Vehicles system.

  Develop skills in systems analysis and skills in modeling

The assignment aims to develop skills in systems analysis and skills in modeling information systems. This assignment is worth 30% of the total assessment. (This is an individual assignment; please complete your work independently.)7002ICT Syst..

  Network security principles

Explain a recent high profile computer security issue that you have heard of. Based on basic network security principles, how might the issue have been avoided?

  Question 1a enumerate the objectives of a procurement

question 1a enumerate the objectives of a procurement development modelb describe one procurement development model you

  Determine values of it industry certifications

Discuss briefly how IT certification works. What business arenas are IT certifications needed, security, or what technical problem is IT certification designed to solve?

  Drawbacks and benefits of a peer to peer network

Describe to Champions the drawbacks and benefits of a peer-to-peer network. What can be shared between hosts?

  The shortest job next sjn algorithm queues processes in a

the shortest job next sjn algorithm queues processes in a way that the ones that use the shortest cpu cycle will be

  Ethics with computer hackers

White Hat Cracking engage security testing by arrangement. Grey Hat Cracking seeks to identify insecure systems and inform administrators or users of vulnerabilities.

  Mobile users and enterprise security

The Baypoint Group requires your help with a presentation for Academic Computing Services, a nationwide company that assists colleges and universities with technology issues.

  The number of data items being manipulated

A function of n, the number of data items being manipulated. For each expression, determine the dominant term and then classify the algorithm in big-O terms.

  A queue is a first-in, first-out list

A queue is a first-in, first-out list. The queue has two essential operations: enqueue, which appends an entry to the end of the list (called the tail ) and dequeue, which returns and removes the first entry in the list

  Solve an increasing number of complex problems

Autonomous (intelligent) software agents are used in Artificial Intelligence to solve an increasing number of complex problems and discuss their main applicability as well as their advantages, limitations and current research trends in the area.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd