Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete the following things: 1. parse and interpret input to the shell 2. create and wait on child processes 3. handle I/O input and
Please complete the following things:
1. parse and interpret input to the shell
2. create and wait on child processes
3. handle I/O input and output redirection, and
4. implement shell internal commands.
Objective Implement a simple shell or command line interpreter Problem Description The Shell or Command Line Interpreter is the fundamental user interface provided by an operating system. Implement a simple shell called blazersh that provides the following functionality: 1. When the shell is invoked by executing the executable blazersh, it should provide a prompt blazersh> and waits for any input from the keyboard. 2. Any input entered will be interpreted as a program to be executed and the shell should create a new process corresponding to the input entered using fork/exec. You can assume that the newline character denotes the end of the input. If a newline character is entered without any other text or followed by white space, the shell should just display the prompt on the next line. The new process created should be able to read keyboard input and display output to the terminal. You can assume that these programs are executed only in the foreground, i.e., the shell program will wait for the child process to complete and when the child process completes successfully it will display the command prompt. Here is a sample interaction with the shell (assuming myprog1 and myprog2 are in one of the directories defined by the PATH environment variable) blazersh> myprog1 Hello World! blazersh> myprog2 5 The 5 values createdd are: 10 11 12 13 14 blazersh> blazersh> myprog2 Enter the number of elements: 5 The 5 values created ar: 10 11 12 13 14 blazersh> 3. The shell program should also support I/O redirection for both standard input and standard output. For example, the command below should execute the program myprogram with command-line arguments arg1 and arg2, use inputfile file for standard input file stream and send standard output file stream to the file outputfile. If the file outputfile does not exist, a new file should be created and if the file outputfile exists, it should be over-written. You can assume that whitespace will serve as the delimiter for the I/O redirection symbols
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started