TUD Logo

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

Operating Systems

Assignment 3: A Simple Shell


Please, submit your solution by e-mail to: martin.kuettler (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.


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: 6th Jan 2020, 2.15 PM
Author: Dipl.-Math. Martin Küttler

Martin K├╝ttler

  • ModuleModules: INF-MA-PR, INF-E-4, DSE-E14
  • 0/0/4 = 4 SWS