Assignment 2. Writing a Shell

Due Monday, April 14 2025, 11:59 pm Central Time.

Submissions handed in by the due date receive a small on-time bonus.

All students are granted a pre-approved extension or “grace period” of 24 hours after the due date. Late submissions are accepted during the grace period with no penalty.

The grace period expires Tuesday, April 15 2025, 11:59 pm Central Time, after which no further late submissions are accepted (or are even possible).

This assignment is an individual homework. No group work is allowed.


In this homework, you’ll be building a shell, similar to the bash shell you use on your CSC4103 Docker image. When you open a terminal window on your computer, you are running a shell program, which is bash on your Docker environment. The purpose of a shell is to provide an interface for users to access an operating system’s services, which include file and process management. sh (Bourne shell) is the original Unix shell, and there are many different flavors of shells available. Some other examples include ksh (Korn shell), tcsh (TENEX C shell), and zsh (Z shell). Shells can be interactive or non-interactive.

For instance, you are using bash non-interactively when you run a bash script. bash is interactive when invoked without arguments, or when the -i flag is explicitly provided. The operating system kernel provides well-documented interfaces for building shells. By building your own, you’ll become more familiar with these interfaces and you’ll probably learn more about other shells as well.

Before you dive into the assignment we suggest you go over Study Guide 1: OS Fundamentals, trying to answer all the questions. This may be a good strategy to get started quickly.

Here is a list of documents that we suggest you read and work on in sequence. This will help to minimize the time you spend on every step between setting up your environment and submitting your work.