CSCI 380 -- Lab 1a

Writing Your Own Unix Shell -- Core

The purpose of this assignment is to become more familiar with the concepts of process control and signaling. You’ll do this by writing a simple Unix shell program.

Start by copying lab1a-handout.tar to your Linux Lab home directory.

Tasks to Perform

You are tasked with implementing a unix shell! This sounds intimidating but it's really not so bad.

Your shell must be able to:

Remember, a shell is an interactive program that runs programs on behalf of the user. It follows a REPL interface: Read Evaluate Print Loop

The command line is a sequence of ASCII test words delimited by whitespace. The first word of this line will be either (1) the name of a built-in command or (2) an absolute pathname of an executable file. The remaining words on the line are command line arguments

ONLY ONE JOB CAN RUN IN THE FOREGROUND AT A TIME

Example

tsh> /bin/ls -l -d

Runs the ls command which will do a long listing on directory files

tsh> /bin/sleep 10 &

Runs the sleep command which will wait at least 10 seconds before ending

Basic Job Control

You are only expected to be able to

  1. start a job in the background (&)
  2. switch the stopped job to the foreground (fg)
  3. kill a currently running job with ctrl+c
  4. stop a currently running job with ctrl+z

Shell Specification

Structure

You are welcome to organize this in any way, but you may find it helpful to structure your code into the following methods:

Submission

Upload/submit tsh.c to autolab.

Grading Criteria

This lab will be graded out of 100 points.