CS 112 Projects: Script Files

Unix-family systems have a program named script that can be used to capture the output of text-based programs. (Cygwin on Windows also provides the script program.) To use this program, just launch a terminal window and enter:

   script
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, plus 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. Show that your files 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'.
    

2. 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:
         ./Debug/proj01 
    If necessary, do this multiple times to demonstrate all the features of your program.

3. Quit the script program

After you have demonstrated that your program runs correctly (including its various 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

That's it!


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