On 3/28/06, Gus Wirth <[EMAIL PROTECTED]> wrote:
> boblq wrote:
> > Hi guys,
> >
> > I would like to capture an interactive session at the keyboard,
> > using bash to exercise a small C program that I have written.
> > Ideally I would get a text file that had a copy of the session,
> > like what I see when I do shift page up ...
> >
> > How do I do that?
>
> Check out the script command:
>
> $ man script
>
> SCRIPT(1)                 BSD General Commands Manual
> SCRIPT(1)
>
> NAME
>       script - make typescript of terminal session
>
> SYNOPSIS
>       script [-a] [-c COMMAND] [-f] [-q] [-t] [file]
>
> DESCRIPTION
>    Script makes a typescript of everything printed on your terminal.
> It is useful for students who need a hardcopy record of an interactive
> session as proof of an assignment, as the typescript file can be printed
> out later with lpr(1).
>
>     If the argument file is given, script saves all dialogue in file.
> If no  file name is given, the typescript is saved in the file typescript.

Note that script(1) saves a lot of things that you might not really
want to see, like all the fancy cursor-movement stuff that goes into
making up your Bash prompt, and of course the carriage-return
characters at the end of the line, and any backspaces that might have
been put in during command-line editing.  But a quick pass with the
editor of your choice will clean this up.

One of these days, if I use script more often, I will get around to
writing a sed script to clean up the output.

    carl
--
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to