Submission
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.
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:
- 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.
- 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).
Resources