TUD Logo

TUD Home » ... » Teaching » Complex Lab Systems Programming » A Simple Shell

Operating Systems

against racism

Assignment 3: A Simple Shell

Submission

Please, submit your solution by e-mail to: doebel (at) os.inf.tu-dresden.de. Don't attach anything to the e-mail (like pdf, docs etc.) other than the requested source code and a Makefile within a tar-archive.

Exercise

In this exercise you are going to write a simple shell that is able to execute command lines, interpret pipes and use input/and output redirection. You are going to use Flex and Bison in order to specify a parser for your command lines and act upon these.

First, implement a shell with the following required features:

  • Execute command lines with the following syntax:
    command <args> [< input_redirect] (| command <args>)* [> output_redirect] [&]
    As a starting point you may (but need not) consider the files provided in the resources section below.
  • Support an arbitrary amount of arguments to programs as well as an arbitrary length for the pipe chain.
  • Detect erroneous input and give useful feedback to the user.

Second, add convenience features to your shell:

  1. The readline library provides line editing features, such as deleting a word. AlibReadline comes along with libHistory which provides means to store strings in a list and navigate through this list. Use both libraries in order to implement easy-to-use line editing as well as access to previously entered commands using the arrow keys.
  2. Add support for the following shell builtins to your shell
    • cd to change to another working directory
    • pwd to print the current working directory
    • kill <signo> <pid> to send a signal to a process
    • alias/unalias to manage aliases (which are replaced by by their meaning during execution of commands).
  3. Resources

Last modified: 28th Sep 2012, 2.12 PM
Author: Dipl.-Inf. Björn Döbel

Contact
Dipl.-Inf.
Björn Döbel

Phone: 463 38799
Fax: 463 38284
e-mail contact form

Regulations
  • ModuleModules: INF-MA-PR, INF-E-4, INF-04-KP, MINF-04-KP-FG2, IST-05-FG-AVS, INF-04-P, DSE-INT
  • 0/0/4 = 4 SWS
Time and Place

Meetings are conducted by arrangement.