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

  Discussion about wireless networking technologies

Your corporation has just occupied an old historic building in which fifteen workers will work. Due to historic building codes, the corporation is not permitted to run cables inside walls or ceilings.

  Illustrate results applying deadlock detection algorithm

Illustrate the results applying deadlock detection algorithm to following data. Give proper description for supporting your answer.

  The dining philosophers problem

Assume the Dining Philosophers problem. Explain the problems and assess what will happen if we allow the following code:a) Pick up chopstick on right, If chopstick on left is free, take it; else drop right chopstick. When done, drop both chopsticks.

  Access time for reading a word from a virtual address

Consider a computer system where the overhead required for reading a word from the page table is 1.25ms. A TLB lookup of a word requires 250 ns.

  Relational database architecture from a network

Determine what would make a corporation or organization migrate to a relational database architecture from a network or hierarchical architecture?

  Deadlock to occur in multiprogramming environment

List the reasons which causes deadlock to occur in multiprogramming environment and discuss how can the deadlock detection algorithm for one resource find out if a deadlock exists in the above sequence

  Network security methodology and technology

Explain the network security methodology and technology used in your organization and recognize any additional controls needed.

  Multiplexor and demultiplexor?

statistical time division multiplexing with 24 stations inputting data at 9600 bps, and assuming that only 60 percent of those stations transmit at one time, what is the minimal speed necessary for the high speed link connecting multiplexor and demul..

  Value in managing security and risk

Explain ISO 27001's value in managing security and risk. What are the drawbacks and benefits for obtaining ISO 27001 certification?

  Calculate effective access time of system

Assuming fetches to main memory are started in parallel with look-ups in cache, calculate the effective (average) access time of this system.

  Priority scheduling in operating system

priority scheduling in operating system

  Commands to help root in managing users and groups

Write other commands, tools are available to help the ROOT in managing users and groups from command line or within a script.

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