Question: Write a command interpreter that will take lines typed in by the user and execute them using the exec and fork commands. After completing the

Write a command interpreter that will take lines typed in by the user and execute them using the exec and fork commands. After completing the command you will prompt for the next command. Check the return code from the last command and if it is not zero print a message reporting on the return code.

A shell reads in a line of input and passes it on to the system. First, you should look at the line of input and determine if it consists of the word exit. If it does you should exit the program. If it contains anything else you will need to pass the various values into the correct program using an exec call that follows the path environment variables (execvp, execlp). No redirection symbols will be given on the command line (<, >, |, >>, etc.).

The program should wait for the command to exit and, if the exit code is non-zero, report the exit code. It should then prompt for the next command. You should submit your program and makefile.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!