This assignment should give you experience in using the fork, exec and wait system calls.
Program
Write a simple command interpreter for Unix systems.
The interpreter should repeatedly print a prompt and wait for the user to enter a command with arguments.
The command can be any executable file. It should be found in any directory listed in the PATH environment variable. The user can specify up to 4 arguments or options to the command. After reading the command, the interpreter should perform the command with its arguments, wait for its outcome, and then prompt the user for the next command.
Upon reading the special command exit, the command interpreter should stop.
Algorithm
call fork to create a child process to perform each command;
call exec in the child process to make the child become the program that is to be executed;
call wait in the parent process so that the interpreter does not print the next prompt until the command is finished.
Sample Run
/z123456 Enter command: mkdir one Enter command: touch one/file one/other one/more Enter command: 1s 1 one total -rw-r--r tudent student 0 Apr 3 13:03 file -rw-r--r tudent student 0 Apr 3 13:03 more -rw-r--r tudent student 0 Apr 3 13:03 other Enter command: gobly gook gobly: No such file or directory Enter command: cd one cd: No such file or directory Enter command: exit