next up gif contents index
Next: Flow Control in Command Up: SPOCK: The Structural Properties Previous: Help

 

History / Command Files

      Spock has a detailed history mechanism that may be used to create command scripts for spock or to replay a session in its entirety. (I'll use the terms history file and command file interchangeably, since they have the same syntax. However, there are some valid command file entries (e.g. loops) that cannot be generated from an interactive session.) History files are plain text files, so they may easily be edited. Spock automatically keeps a log of all user actions for a particular session in the a file, usually $SP_HISTORY/.spockhist. Both the path and the file name are customizable, however. You may set $SP_HISTORY in your .spockrc file, and you can specify the history file name with the "-h" or "-history" command line options (§ 3.8). The best way to create command scripts is to copy and edit the .spockhist file after an interactive session. The syntax of the command file is described below. If you wish to run two spock sessions at the same time, you should use the "-h[istory] option in order to keep the second process from clobbering the history file of the first. When spock is reading a history file, typing, Ctrl-Z will pause the history file and Ctrl-C will abort it.

First, a note on comments. The safest way to create a comment is to begin a line with the exclamation point character. Lines beginning in this manner are ignored. However, since (as will be described below) history file lines all begin with a record identifiers, lines need not use have this comment delimiter. Any line not begun with a recognized record identifier is ignored. (I've used this duality to good effect in the file $SPOCK/bin/webspock. This file is both a Bourne-shell script and a spock command file. Check out the file to see how that was done.)

As mentioned, valid spock history lines begin with a record ID. This is simply a string of three or four uppercase characters, followed by ``>'' and one or two spaces so that the total length of the record id is six characters. The record ID simply indicates what kind of information is contained in this line. The various record types are described below:




next up gif contents index
Next: Flow Control in Command Up: SPOCK: The Structural Properties Previous: Help

Jon Christopher
Tue Sep 14 16:44:48 CDT 1999