Using the command line interface of debug

Script command

The script command reads and executes a text file containing debugger commands. A script may contain any debugger command, including other script commands. In the example below, script is invoked with the -q (for quiet) option. If -q were not supplied, debug would echo each command as it is executed.

   $ cat setup
   set %global_path = "libcmd/common:libexp/common"
   create xyz < >test.out
   stop main
   $ debug
   debug> script -q setup
   New program xyz (process p1) created
   HALTED p1 [main in xyz.c]
   EVENT [1] assigned
Scripts can be useful when you have to do the same series of steps more than once. However, if you don't know what that series of steps will be the first time through, use command logging. Command logging gives you an easy way to create a script. The debugger will save each command as you type it and you can edit the log file later to remove extraneous commands. The debugger saves both the commands and the output generated from the time you type logon until you type logoff or quit. The output the debugger generates is written to the log file as comments, so you can use the log file as a script -- as is -- without the debugger's output interfering with the commands.
   debug> logon logfile
   debug> create h
   New program h (process p1) created
   HALTED p1 [main in h.c]
   debug> stop main
   EVENT [1] assigned
   debug> logoff
   . . .
   $ cat logfile
   create h
   #New program h (process p1) created
   #HALTED p1 [main in h.c]
   stop main
   #EVENT [1] assigned

Next topic: Defaults file
Previous topic: Aliases with arguments

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005