|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
| News | Shells | Recommended Links | Reference | ||
| Keystroke Log Utilities and Macrorecoders | tee | Screen | Humor | Etc |
The external script command makes a copy (typescript) of a terminal session. The most common use of script is to document 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. In a way script is a specialized tee for the shell.
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.
Format of the script command.
script [ -a ] [ typescript_file ]
Options
-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.
typescript file specifies output file. If no output file is specified, the output of script is placed in the typescript file.
If applications with cursor control were used, 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.
Creating a Script file on a Unix system
AIX
Makes a typescript of a terminal session.
script [ -a ] [ File ]
The script command makes a typescript of everything displayed on your terminal. The typescript is written to the file specified by the File parameter. The typescript can later be sent to the line printer. If no file name is given, the typescript is saved in the current directory with the file name typescript.
The script ends when the forked shell exits.
This command is useful for producing hardcopy records when hardcopy terminals are in short supply. For example, use the script command when you are working on a CRT display and need a hardcopy record of the dialog.
Since the script command sets the SetUserID mode bit, due to security reasons the value of LIBPATH variable is unset when the command is invoked. However, LIBPATH is automatically reset in the forked shell if it is defined in the environment file. For related information, see the exec subroutine.
| -a | Appends the typescript to the specified file or to the typescript file. |
| /usr/bin/script | Contains the script command. |
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Last modified: August 08, 2009