Home arrow Study arrow Projects arrow Writing a Unix Shell
Writing a Unix Shell PDF Print E-mail

48450 Real-time Operating Systems

Spring 2005

Assignment 2

Due date: Friday, 28th October
Contribution to final mark: 20% (marked out of 20 marks also)
Mode: Individual completion and submission

Introduction

This assignment permits you to select from a collection of independent options based on your interests and motivation. The options are graded such that there are ceiling marks associated with each – this is used to reflect the level of depth and difficulty associated with the option. The topic descriptions are deliberately open-ended, affording you the opportunity to set the scope of work. A submission will be marked on its merits and will be awarded a mark which is less than the ceiling if it's of modest quality. You should select one of the options only, complete it including a reflective self assessment in the conclusion and submit it by the due date above. Submission details will be made available at a later date.

Option C

Class of work: Research Investigation, Kernel Programming Exercise
Ceiling: 20 marks out of 20
A demanding programming exercise, not for the fainthearted

Topic 1: uClinux shell This topic follows on from your programming task in Assignment 1 and involves the development of a shell which is to be developed under Linux on the coldfire server and then ported to uClinux. The uClinux default shell is “sash” which you've used in Assignment 1, but now you're asked to develop your own. This option is based in “Programming Project One: Developing a Shell” from page 153 of the textbook. In order to scale down the requirements a little, I suggest your shell should meet the following requirements (a subset of those listed on pages 153 and 154).

1. The shell must support the following internal commands:

  • i. cd - change the current default directory to . If the argument is not present, report the current directory. If the directory does not exist an appropriate error should be reported. This command should also change the PWD environment variable.
  • ii.
  • iii. dir - list the contents of directory
  • iv. environ - list all the environment strings
  • v. echo - display on the display followed by a new line (multiple spaces/tabs may be reduced to a single space)
  • vi. help - display the user manual using the more filter
  • vii.
  • viii. quit - quit the shell
  • ix. The shell environment should contain shell=/myshell where /myshell is the full path for the shell executable (not a hardwired path back to your directory, but the one from which it was executed)

2. All other command line input is interpreted as program invocation which should be done by the shell forking and executing the programs as its own child processes. The programs should be executed with an environment that contains the entry: parent=/myshell where /myshell is as described in ix. above.


My solution for this project is divided into two parts, for pure Linux environment and for uClinux, an embedded development operating system. Source code can be downloaded from here, but further modification or use please credit my original author right.

Linux Source Code

uCLinux Source Code

If you are not already familiar with uClinux, you can visit my previous project on uClinux here.