CS162 HW 2 Shell

CS162 HW 2 Shell
In this homework, you’ll be building a shell, similar to the bash shell you use on your CS 162 Virtual Machine. When you open a terminal window on your computer, you are running a shell program, which is bash on your VM. 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.

Getting started
To get started, log in to your development environment and get the starter code.

cd ~/code/personal/
git pull staff main
cd hw-shell
We have added starter code for your shell which includes a string tokenizer that splits strings into words. To run the shell,

cd ~/code/personal/hw-shell