A little command shell

Assigned 9/27/05, due 5:00PM Monday, 10/3/05. Hand in using HSP.

Write a small command shell. In particular, your shell should:

  1. Print a prompt.

  2. Get a command line from the user

  3. Search the $PATH environment variable for a program whose name is the first word in the command string, and fork a child process to execute the first such program found, passing the command-line arguments (including the program name itself) to the program (or printing an error message if no command is found)

  4. wait for the execution to finish (unless the command was terminated with an &, in which case you should go to step 5 immediately).

  5. Go to step 1.

Your shell should also trap CTL-C's--upon receiving a SIGINT, it should tell the user to type CTL-] followed by <return> to quit your shell.

You may work with a partner or alone, as you wish.

Here are a few technical points that may interest you:




Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, (507) 646-4364, jondich@carleton.edu