CSCI 320 - Operating Systems & Concurrency

Spring 2019

Rush - the Rust Shell, part 1

Assignment

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
    hello.py	one.txt		two.txt
    bash$ ls *.txt
    one.txt		two.txt
    bash$ ls *.py
    hello.py
    bash$ 
    
    For this assignment, you need only be concerned with pattern-matching files in the current directory. You may also assume that there will be no more than one occurrence of the pattern-matching character.

Grading

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.

Acknowledgement

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