Answered step by step
Verified Expert Solution
Question
1 Approved Answer
As we introduced in class, the four functional characters I, &) are for input redirection, output redirection, pipe and background jobs respectively. By default, they
As we introduced in class, the four functional characters I, &) are for input redirection, output redirection, pipe and background jobs respectively. By default, they can be interpreted correctly by a UNIX terminal, but not by a C/C++ program. In a UNIx terminal if you type in "echo hello filel", you will find a file named "filel" created which has string "hello" stored inside, and that's because the terminal interpreted correctly and redirected the output of string "hello" from screen to "filel" In our Project 1, we want you to write a C/C++ program to interpret all these four functional characters as a UNIX terminal does. So when your program is running, we expect it to allow the user to type in a command line and if the user types in "echo hello filel", the same thing as in a UNIX terminal should happen. This is only the test for output redirection, and we expect the other three functional characters to be interpreted correctly as well. Note that function "system" cannot be used in your program because it will do everything for you. For example, "system("echo hello filel")," can give the right result without needing you to do anything. Instead, we want you to use system calls for process management and file systems, such as fork waitpid, execvp, exit pipe dup, open close, etc. First, your program should read in the user's command line and store it in an array. Then it checks if any of the four functional characters is in the array and will do corresponding work if so
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