This MP will be graded as follows:


  1. If your code fork bombs during grading, the autograder will not be able to continue. This often results in the grader unable to record meaningful output from your program and will be a 0 if the autograder does not record output!
  2. Please make doubly sure that your fork() code is correct before committing your code for the nightly autograder.
  3. Please print the PID of the process executing the command i.e. the PID of the child process.

Introduction

In this MP, you will implement a simple Unix shell interpreter (e.g., bash, csh etc.) called Shell. The basic function of a shell is to accept commands as inputs and execute the corresponding programs in response.

The purpose of this MP is to help you learn the basics of system calls for creating and managing processes as you implement your Shell program. You will write the code for your Shell program in shell.c inside your mp3 directory. The two other files you will write inside your mp3 directory: log.c and log.h will provide the implementation of a generic data structure log_t that you will use to implement the history feature of your Shell.

If you are not sure about the details of how shell should behave in some circumstances, Check this Piazza Post

Part 1: Log

You will implement the data structure: log_t. You can find details on this data structure in the source code or the generated documentation.

Part 2: Shell

To execute multiple commands, your shell should run in a loop where each iteration performs the following actions:

Compiling and Running

To compile and run your shell, run the following commands from a Terminal on a Linux machine:

$ make
$ ./shell [args]

Type "exit" to exit from Shell (or if this has not yet been implemented, Ctrl+C will work).

Grading, Submission and Other Details

Please fully read Grading Policy for more details on grading, submission, and other topics that are shared between all MPs in CS 241.