Question: Can you please help me understand this? If possible, please include comments and help me understand :( Can you please help me understand this? If

Can you please help me understand this? If possible, please include comments and help me understand :(

Can you please help me understand this? If possible, please include comments

and help me understand :( Can you please help me understand this?

Can you please help me understand this? If possible, please include comments and help me understand :(

In this assignment, you will write a complete C program that will act as a simple command-line interpreter (i.e., a shell) for the Linux kernel. In writing your shell, you are expected to use the fork-exec-wait model discussed in class. In particular, you are to implement the following: Loop continuously until the user enters quit, which exits your shell. Inside the loop, you will print your minor3" prompt and read in the user's command, which may consist of a Linux command with 0 or more options and arguments supported by the command. You are expected to read in and process only 1 command at a time with no pipelining or redirection, but you must be able to handle any options and arguments supported by the command. Note that shell built-in commands, such as cd, history, and exit, are not expected to work as they are built-in to the shell itself. In a child process, you are to execute the command as given, including all options and arguments given. If the command is not valid, rather than display an "exec failed" message as shown in class examples, you will simply print out the command itself with "command not found" as shown in the SAMPLE OUTPUT and then exit the child process. The parent process should wait for the child process to finish. You are not allowed to use the system() system call in this assignment. If you have any questions about this, please contact your instructor or TAs assigned to this course to ensure you understand these directions. SAMPLE OUTPUT (user input shown in bold): $ ./a.out who.txt minor3> ls a.out grades.txt rec01.txt testdir phone.txt route.txt du.txt rec01.c filei rec01sol.c minor3.c minor3> ls -a -1 -t total 144 -EX----- 1 mat0299 mat0299 7835 Feb 14 17:39 a.out drwx-- 4 mat0299 mat0299 4096 Feb 14 17:39 -rw----- 1 mat0299 mat0299 2665 Feb 14 17:39 minor3.c -rw---- 1 mat0299 mat0299 33 Feb 5 03:30 du.txt 1 mat0299 mat0299 33 Feb 5 01:28 filel -IW----- 1 mat0299 mat0299 333 Feb 5 01:02 route.txt drwx--- 2 mat0299 mat0299 4096 Feb 3 20:36 testdir -rw------ 1 mat0299 mat0299 116 Feb 2 23:38 who.txt -IW------- 1 mat0299 mat0299 52 Jan 24 11:15 phone.txt -rw------- 1 mat0299 mat0299 200 Jan 19 02:37 grades.txt -IW---- 1 mat0299 mat0299 1634 Jan 2 15:08 rec01.c -IW----- 1 mat0299 mat0299 160 Jan 2 14:58 rec01.txt -IW------- 1 mat0299 mat0299 1451 Jan 2 14:58 rec01sol.c drwx------ 18 mat0299 mat0299 4096 Dec 12 21:04 .. minor 3> ls -alt total 144 -IW------ 1 mat0299 mat0299 7835 Feb 14 17:39 a.out drwx---- 4 mat0299 mat0299 4096 Feb 14 17:39 . -IW--- 1 mat0299 mat0299 2665 Feb 14 17:39 minor3.c -rw- 1 mat0299 mat0299 33 Feb 5 03:30 du.txt ---- 1 mat0299 mat0299 33 Feb 5 01:28 filel ----- 1 mat0299 mat0299 333 Feb 5 01:02 route.txt drwx-- 2 mat0299 mat0299 4096 Feb 3 20:36 testdir -IW----- 1 mat0299 mat0299 116 Feb 2 23:38 who.txt -rw------ 1 mat0299 mat0299 52 Jan 24 11:15 phone.txt -IW------ 1 mat0299 mat0299 200 Jan 19 02:37 grades.txt -rw------- 1 mat0299 mat0299 1634 Jan 2 15:08 rec01.c ---- 1 mat0299 mat0299 160 Jan 2 14:58 rec01.txt -IW------- 1 mat0299 mat0299 1451 Jan 2 14:58 rec0lsol.c drwx------ 18 mat0299 mat0299 4096 Dec 12 21:04 minor3> sdjdsf sdjdsf: command not found minor3> cd .. cd: command not found minor3> quit $

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!