CS 112 Projects: Script Files

Most Unix systems have a program named script that can be used to capture the output of text-based programs. To use this program, just launch a terminal window and enter:

and the program will begin running. The program will create a new file named typescript in which it will record anything that subsequently appears in that terminal window. We will use the script program in this course to demonstrate that your programs work correctly by having you do the following steps inside the script recording:
  1. list the source files (.h, .cpp) of your project and any text files (.txt) on which they depend,
  2. show that they compile and link correctly, and
  3. run your project from the command-line.

0. Getting started

  1. Open a Terminal window
  2. Use the cd command to navigate to your project folder.
  3. Enter the script command, and you should see the following message:
          Script started, file is typescript

1. Listing your source files

  1. Use the ls command to list the contents of your project directory.
  2. Use the cat command to list your main program and each of the .h, .cpp, and .txt files in your project folder.

2. Show that they compile and link correctly

  1. Use the cd Debug command to descend into your Debug directory.
  2. Use the ls command to list the contents of your Debug directory.
  3. Use the make all command to show that your program has compiled and linked correctly. If it has, a message like this should be displayed:
          make: Nothing to be done for `all'.

3. Run your program

  1. Use the cd .. command to navigate back "up" to your project folder.
  2. Since your executable program is in your project's Debug directory, Run your program by entering ./Debug/ followed by its name. For example, if your program is named proj01, you would enter:
    If necessary, do this multiple times to demonstrate all the features of your program.

4. Quit the script program

After you have demonstrated that your program runs correctly (including its various 120 features), press Control-d (hold down the Ctrl key, then press the d key) to terminate the script program. You should see a message:
      Script done, file is typescript

5. Print hard copies

You can use either of two printer commands to print a hard copy of the typescript file created by the script program: Once you have printed a hard copy of your file, retrieve your hard copy from the printer, staple a copy of the project gradesheet to its front, and write your name in the appropriate place on the gradesheet. If you want to make the grader's life easier, use a highlighter to highlight each of the commands you entered, so that the grader can find them more easily.

That's it!

Calvin > CS > 112 > Projects
This page maintained by Joel Adams.