Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You need to take user input as we did in shell ( any five commands of your choice from Lab 1 along with a .

You need to take user input as we did in shell (any five commands of your choice from Lab 1
along with a.out file that contain any code such as argument display or hello world)
and according to the given input,
first you need to create the child process
and then you need to display the command output accordingly.Program would terminate when user enter "Exit".
Incase of invalid input you need to print "invalid argument" and
error in case of exec failure or fork.
For this task you need to use atleast four family function of exec.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
p=fork();
if(p==0)
//child
//get user input a for example (ls)
or use case if(a==ls)
//exec("bin/ls","ls","/dir",NULL)
else
execvp()
elseif(cat)
execlp()
elseif()
//parent
wait(NULL)

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

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago