Module 116 script

Previous Table of Contents Next


Module 116
script

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.

1.    Type script and press Return . Your output is saved in the typescript file.
 cj> script      Script started, file is typescript      cj> 
2.    Now perform several UNIX commands. For example, type ls and press Return .
3.    Type cat /etc/ group and press Return to have output sent from the computer to your terminal.
4.    Now stop script from tracing. Type exit and press Return .
 cj> exit      Script done, file is typescript      cj> 
5.    Display the output of script by typing more typescript and pressing Return .
6.    Type rm typescript and press Return to remove the output file created by script .
7.     Turn to Module 60 to continue the learning sequence.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net