pop up description layer
Last modified: 20080825:085636/Added material about submission name and use of public svn

FIT2022 AJH-2008-20

Assignment 1

Assignment 1: A Python Shell | Use of SVN

Assignment 1: A Python Shell

The Shell or Command Line Interpreter is the fundamental User interface to an operating system. Your assignment is to write a simple shell, called myshell.py, in Python, that has the following properties:

  1. The shell must support the following internal commands:
    1. cd <directory> - Change the current default directory to <directory>. If the <directory> argument is not present, report the current directory. If the directory does not exist, an appropriate error should be reported. This command should also change the PWD environment variable.
    2. clr - clear the screen.
    3. dir <directory> - List the contents of directory <directory>.
    4. environ - List all the environment strings.
    5. echo <comment> - Display <comment> on the display followed by a new line (multiple spaces/tabs may be reduced to a single space).
    6. help - Display the user manual using the more filter.
    7. pause Pause operation of the shell until 'Enter' is pressed.
    8. quit - Quit the shell.
    9. The shell environment should contain shell=<pathname>/myshell where <pathname>/myshell is the full path for the shell executable (not a hardwired path back to your directory, but the one from which it was executed).
  2. All other command line input is interpreted as program execution, which should be done by the shell forking and execing the programs as its own child processes. You can use the Python library Process Management functions (fork and exec) from the os module for this. The programs should be executed with an environment that contains the entry parent=<pathname>/myshell.py where <pathname>/myshell.py is as described in para 1.ix above.
  3. The shell must support i/o redirection on either or both stdin or stdout. That is, the command line
    programname arg1 arg2 <inputfile >outputfile
    will execute the program programname with arguments arg1 and arg2, the stdin FILE stream replaced by inputfile and the stdout FILE stream replaced by outputfile.

    With output redirection, if the redirection character is > then the outputfile is created if it does not exist, and truncated (to empty) if it does. If the redirection token is >> then outputfile is created if it does not exist, and appended to if it does.

  4. The shell must support background execution of programs. An ampersand (&) at the end of the command line indicates that the shell should return to the command line prompt immediately after launching that program.
  5. The command line prompt must contain the pathname of the current directory.

Check the Wiki Page for helpful hints. For example, this program might be useful.

A marking quide is available.

You should submit all your python files necessary for the shell as a zipped archive through the Moodle assignment 1 submission mechanism. Name the zip file yourStudentID.zip

Use of SVN

It has come to my attention that several students have put their assignments in the public space of the svn repositories. Not only is this contrary to the instructions given in lectures about the use of svn, it also contravenes university policy.

Students whose work is found in the public areas will have the work removed, and will receive NO marks for the assignment. I will offer a period of grace in this case, and if anyone wishes to acknowledge that they a) mistakenly placed their work in a public area, or b) used any submissions in the public area to construct their own submissions, then I will waive the penalty.

This offer will stand until Wednesday, 27 Aug, 12noon.


Document History

20080825:085636 2.0.4 ajh Added material about submission name and use of public svn
20080812:114938 2.0.3 ajh Added link to wiki assignments page
20080801:095042 2.0.2 ajh corrected myshell.py references and updated marking guide
20080724:124410 2.0.1 ajh updated with questions 4 and 5
20080712:140751 2.0.0 ajh first version for 2008

This page maintained by John Hurst.
Copyright Monash University Copyright Policy
716 accesses since
28 Jul 2008
My PhotoTrain Photo

Generated at 20090705:1754 from an XML file modified on 20080828:1547
Maintainer use only; not generally accessible: Local ServerWork ServerCSSE Server

825 accesses since 28 Jul 2008, HTML cache rendered at 20091125:0148