Question: Description: You are going to write a very simple command interpreter that will take lines typed in by the user and execute them using the
Description:
You are going to write a very simple command interpreter that will take lines typed in by the user and execute them using the exec and fork commands. Upon completion of the command you will prompt for the next command. You should check the return code from the last command and if it is not zero print a message reporting on the return code.
Details: A shell reads in a line of input and passes it on to the system. We will be doing this in a very simple form. 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.). Your 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.
Step by Step Solution
There are 3 Steps involved in it
To create a simple command interpreter as described you will need to delve into some aspects of UnixLinux system programming The task involves using system calls such as fork and exec family functions ... View full answer
Get step-by-step solutions from verified subject matter experts
