Creating an Audit Trail

The Unix system command script provides a convenient method of documenting the results of running a program. It also provides authentication of the time and date at which a project was finished.


Text-Based (Non-Graphical) Programs

The following is an example of the sequence to use to obtain a time stamped version of a program's source listing and example trial runs.

 > script sample.ts
 > cat main.c
 > cat stack.c
 > gcc -c main.c
 > gcc -c stack.c
 > gcc -o main main.o stack.o
 > main < data
 > exit

Notes

  1. The precise sequence of commands used inside a script file depends on what you are trying to document. Don't blindly type the commands listed.

    Typically, you'll want to have, in the same file:

    1. source listings [that's where the cat command is needed]
    2. a demonstration that the different program components compile
    3. several examples of the program in execution

  2. You need to use a different name for each script file.
    For example, for multipart assignments, you might name the files 1a.ts, 1b.ts, etc.

  3. Also, you won't necessarily have a data file, etc.

  4. Be sure to exit from the script!


Graphical Programs (like Java Applets)

Even though you can't capture and demonstrate the correct workings of a graphics-based program, you should document the timely completion of a project by scripting the source code listings and compilations as above.

 > script another.ts
 > cat Main.java
 > cat Stack.java
 > javac Main.java
 > javac Stack.java
 > exit


Be sure not to edit or delete the script file during the entire term.

For more information about using 'script', issue the command:

       man script


Another example, this time making a script file to record an example using CLIPS code.

Script started on XXXXXXXXXXXXXXX 05:55:39 PM EST

 > cat comedy.clp

;;;; file: comedy.clp - rules for comedians
;;;; Name:       J. Random Student
;;;; Assignment:  program 9 - comedy expert system
;;;; Due Date:    August 13, 2010
;;;; Description: This program attempts to address three issues
;;;;     1) how to create a correct script file
;;;;     2) how to program in clips
;;;;        a) how to write clips code
;;;;        b) how to run a clips program
;;;;     3) creation of an expert system for comedy writers
;;;;        blah, blah, blah
;;;; System description: blah, blah, blah
;;;;

;;;; form of facts in antecedents
(deftemplate present (slot what))

;;;; form of facts in consequents
(deftemplate action (slot to-perform))

(defrule fred "what fred would do"
   (present (what hammer))
   =>
   (assert (action (to-perform "hit self on thumb"))))

(defrule ethel "what ethel would do"
   (present (what vase))
   =>
   (assert (action (to-perform "drop vase"))))

(defrule lucy "what lucy would do"
   (present (what hammer))
   (present (what vase))
   =>
;  (assert (action (to-perform "hit self on thumb")))
;  (assert (action (to-perform "drop vase"))))
   (assert (action (to-perform "hit vase"))))


(defrule tell-me-about-it-1 "tell the writers what to do"
   (action (to-perform "hit self on thumb"))
   =>
   (printout t "have the comedian hit him/herself on the thumb" crlf))

(defrule tell-me-about-it-2 "tell the writers what to do"
   (action (to-perform "drop vase"))
   =>
   (printout t "have the comedian drop the vase" crlf))

 > clips

         CLIPS (V6.0 05/12/93)

CLIPS> (load comedy.clp)

Defining deftemplate: present
Defining deftemplate: action
Defining defrule: fred +j
Defining defrule: ethel +j
Defining defrule: lucy =j+j
Defining defrule: tell-me-about-it-1 +j
Defining defrule: tell-me-about-it-2 +j
TRUE

CLIPS> (watch rules)
CLIPS> (reset)

CLIPS> (assert (present (what hammer)))
<Fact-1>

CLIPS> (run)

FIRE    1 fred: f-1
FIRE    2 tell-me-about-it-1: f-2
have the comedian hit him/herself on the thumb
CLIPS> (exit)

 > exit

script done on XXXXXXXXXXXXXXX 05:56:53 PM EST