Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For your first Homework, you will write a simple program to read commands from the console and execute them. The mini shell should look for

image text in transcribed

image text in transcribed

For your first Homework, you will write a simple program to read commands from the console and execute them. The mini shell should look for commands in the current path to execute and, if they are present, execute them. If the command is not found an error message stating "command not found" should be sent to cerr or stderr. Rather than just executing commands as typed you will have an alias facility. The alias facility will allow the user to customize commands. For example, if they would prefer dir rather than Is they would type alias dir is And then when they type dir your program will substitute in ls (for the first argument only). The alias facility can also include multiple words or flags and they can be substituted. Another example would be: alias print Ipr - Plj1026 "Print results in two arguments substituted - Ipr and -Plj1026 No, you can't alias an alias" Which would substitute Ipr for the first argument followed by -Plj1026 for the second argument. "If you said alias p print It shouldn't check on print being an alias and substitute in the Ipr -Plj1026 command..." Your shell should fork and execute the command in a separate process.(You are NOT allowed to use the system call. Must be fork/exec/wait) It should then wait for the command to finish and print out the status code for the job along with the resource usages (see wait3 and wait4 calls). Lastly, your shell should keep a list of the commands that have been run (a history) and at the end of the shell session it should be saved in a file named .minihistory. (Command after alias substitutions should be saved.)* In this assignment you will NOT be doing wildcard substitution, redirection, piping, or actually use the history. We may choose to do that later. Struct's Structures are what was in C prior to C++. They group together fields into a single variable. There are no methods with a struct There are no access types with a struct (private, There are no access types with a struct (private, public, protected) Everything is public they are just there to allow easy grouping of data. Accessed the same way an object would be: struct rusage r; cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions