Pre-lab 12

The Unix Shell

Goals

  • Integrate some of your knowledge of systems programming. Early in the semester, when you were beginning to learn to program on the Unix API, you developed the basic functionality of a shell. Back then, you were concerned only with being able to spawn a process that would execute a given program. Since then, you have learned so much more about operating systems and Unix programming (hopefully!) In this lab, you will push the implementation of your shell a little further along. The new functionality will lead you to revisit some of the concepts in concurrency and apply some of your recently acquired knowledge on the file system interface.

Credits

This lab was developed by Prof. L. Felipe Perrone. Permission to reuse this material in parts or in its entirety is granted provided that this credits note is not removed. Additional students files associated with this lab, as well as any existing solutions can be provided upon request by e-mail to perrone[at]bucknell[dot]edu


Set Up

In your git repo, create a working directory for this lab:

~/youruserid/csci315/Labs/Lab12/

Problem 1

Revisit the specifications of Assignment 1 and the solution that you submitted previously. Take the time to verify that everything works as expected. If you discover any bugs, anything that needs to be fixed, take care of it and resubmit for full credit.

If you didn’t provide the unspecified, additional feature with your first submission, take this opportunity to work on it. Make sure to include a comment at the top of your myshell.c file  indicating what your chosen feature is and how to use it. 

Whether or not you changed anything in your original submission, you should do:

  • cd ~/youruserid/csci315/Labs/Lab12
  • git add myshell.c
  • git add Makefile
  • git commit -m “pre-lab 12, problem 1 completed”
  • git push

Problem 2

Change your shell so that it can execute two programs in sequence when they are presented in the command line separated by a semi-colon ‘;‘ character. That is, if the user enters:

myshell> prog1; prog2

myshell will execute prog1 first, wait for its termination, then execute prog2, wait for its termination, and only then return the prompt to the user. Note that you are being asked to do this for only two programs separated by a semi-colon. If you want to generalize this more programs (also separated by semi-colons), that a nice extension to work toward.

When you are done with this, you should do:

  • cd ~/youruserid/csci315/Labs/Lab12
  • git add myshell.c
  • git commit -m “pre-lab 12, problem 2 completed”
  • git push
Print Friendly