51.5 Copy What You Do with scriptAre you typing a complicated set of commands that you need to show someone else or keep "on file" for documentation? Are you debugging a program that goes wrong somewhere - but the error message flashes by so fast that you can't see it? Do you want to show a "pre-recorded" demonstration of an interactive program? The script program can help with all of these problems.
To copy everything you do into a file, just type:
%
Now you can type any UNIX command that you'd use at a shell prompt.
Everything you do is copied into a file named
typescript
in the
current directory.
(To use a different filename, type its
pathname (
1.21
)
on the command line, like One thing that surprises people is that everything will be copied into the script file. That includes escape sequences ( 5.8 ) that programs send to your terminal. This is both good and bad. The good part is that you can "play back" whatever happened by cat ting ( 25.2 ) the script to your screen. When things get boring, you can run an interactive program like vi inside the script - then quit the script and play it back with cat typescript . The cursor will fly across the screen and your file will be re-edited before your eyes. (This is easier to see if the terminal is set to a slow data rate.)
The bad part is that errors you correct and other terminal-control sequences
will be in the file, too.
If you edit or print the script file, it may be full of "junk" like
- |
|