CSCI 420 - Operating Systems & Concurrency

Spring 2017

Rush - the Rust Shell, part 1


In this assignment, we will begin implementing an interactive Unix shell using the Rust language. Implement your shell according to the following steps:
  1. Write a program that accepts one line of standard input at a time.
  2. Using the cd program fails to change the directory, as the directory change only affects the child process. Add a built-in cd instruction that changes the current working directory of the shell process itself. Its argument is the target directory. If no argument is supplied, it should change to the user's home directory, which is accessible through the HOME environment variable.
  3. The * character is a pattern-matching wild card character. It matches zero or more arbitrary characters. For every command-line argument containing this character, replace it with one or more command-line arguments that are all valid matches from the file system. The updated command-line arguments should be what gets passed to the child process. Here is an example:
    bash$ ls	one.txt		two.txt
    bash$ ls *.txt
    one.txt		two.txt
    bash$ ls *.py
    For this assignment, you need only be concerned with pattern-matching files in the current directory.


Completing step one is worth 20 points. The second two steps are each worth 10 points. The total value of the assignment is 40 points. No credit will be given for code that fails to compile. Partial credit may be given for incomplete or flawed versions of a given step.


This assignment was adapted from materials developed by David Evans at the University of Virginia.