Question: 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

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!