Previous | Table of Contents | Next |
DESCRIPTION
The external script command makes a copy (type script ) of a terminal session. When you run script a new shell is forked. This new shell makes a complete copy of everything displayed on your terminal. It reads standard input and output for your terminal tty and stores the data in a file . The default filename is typescript .
To exit from a script session you simply press Ctrl-D or type exit.
COMMAND FORMAT
Following is the general format of the script command.
script [ -a ] [ file ]
Options
The following option may be used to control how script functions.
-a | Append the output of script to file . Normally script begins writing to a new file; if the file exists it is overwritten unless you specify the -a option. |
Arguments
The following argument may be passed to the script command.
file | The file script uses to save all data. |
If no file is specified then the file named typescript is used. |
RELATED COMMANDS
Refer to the tee command described in Module 134.
RELATED FILES
If no output file is specified, the output of script is placed in the typescript file.
APPLICATIONS
The most common use of script is to make a copy of a terminal session. By starting script you can save all the information, displayed on your terminal during a login session, to a file. You can then print the file or view it with an editor.
NOTE:
Remember, if you used applications with cursor control, those control characters will reside in the output file produced by script . Therefore, if you send the file to a printer or terminal, it may not print or display properly. You can use the col command to remove control characters from the typescript file.
TYPICAL OPERATION
In this activity you use the script command to make a typescript of a few commands. Begin at the shell prompt.
cj> script Script started, file is typescript cj>
cj> exit Script done, file is typescript cj>
Previous | Table of Contents | Next |