Question: Translate the pseudo-code below into a C program to act like a small shell that processes single commands entered by the user. In particular, the
Translate the pseudo-code below into a C program to act like a small shell that processes
single commands entered by the user. In particular, the program assembles the command and
execute it. The commands/programs location can be anywhere in $PATH and might have arguments.
E.g., if the input-line entered by the user is
ls -F
your program should assemble this command-lines and execute it.
The pseudo-code
Algorithm:
While(1)
begin
read command line from user // Use Unix read/write system calls
assemble command args
duplicate current process (fork)
child should exec to the new program
parent process waits for its child to terminate
end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
