Question: Write a program ( myshell 1 . c ) to do the following task in a loop ( 1 ) get a command from standard

Write a program (myshell1.c) to do the following task in a loop
(1) get a command from standard input, into a variable
(2) if the command is "exit"
then exit the program (to be terminated)
else if the command is "listall"
then you replace the input by "Is -la"
else if the command is "showme"
then replace the command by "w | grep xyz" where xyz is the first 3 characters of your netid
for example, w | grep rkm (for netid=rkm010300)
else run the command via system call
call a system call to run the input command, e.g., system("Is -l");
(3) repeat the loop (that is, back to step (1)).
compile the program (and its executable name is: myshell1) and run the program with the following input commands
date ; hostname ; uname -a
Is -I
Is ->> mydir.txt
Is -I $HOME > myhome.txt
who | grep 'whoami'
w > myuser.txt ; w | grep 'whoami'
listall
showme
Is -I myshell1.c
head myshell1.c
exit
 Write a program (myshell1.c) to do the following task in a

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!