From d41149a8e9cbb76ff89322a3363299f1b93823d2 Mon Sep 17 00:00:00 2001 From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 5 Jan 2021 16:28:32 +0100 Subject: Add some examples to script.1 While here: - Split synopsis into two parts. The first explains how to record sessions, while the second one explains how to replay (some of) the recorded sessions. - Fix the -width argument of the environment variables list. MFC after: 1 week --- usr.bin/script/script.1 | 70 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 681440e7274a..04fa75fc1612 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -36,10 +36,14 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl adefkpqr +.Op Fl aefkqr .Op Fl F Ar pipe .Op Fl t Ar time .Op Ar file Op Ar command ... +.Nm +.Fl p +.Op Fl deq +.Op Ar file .Sh DESCRIPTION The .Nm @@ -143,7 +147,7 @@ The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT The following environment variables are utilized by .Nm : -.Bl -tag -width SHELL +.Bl -tag -width SCRIPT .It Ev SCRIPT The .Ev SCRIPT @@ -169,6 +173,68 @@ is not set, the Bourne shell is assumed. .Pq Most shells set this variable automatically . .El +.Sh EXAMPLES +Record a simple +.Xr csh 1 +session with no additional details like input, output, and timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script +Script started, output file is typescript +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +Now, replay the session recorded in the previous example: +.Bd -literal -offset indent +$ cat ./typescript +Script started on Tue Jan 5 15:08:08 2021 +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:08:13 2021 +.Ed +.Pp +Record a +.Xr csh 1 +session, but this time with additional details like timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script -r +Script started, output file is typescript +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +In order to replay a sessions recorded with the +.Fl r +flag, it is necessary to specify +.Fl p +.Po +.Xr cat 1 +will not work because of all the aditional information stored in the session file +.Pc . +Also, let us use +.Fl d +to print the whole session at once: +.Bd -literal -offset indent +$ script -dp ./typescript +Script started on Tue Jan 5 15:17:09 2021 +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:17:14 2021 +.Ed .Sh SEE ALSO .Xr csh 1 .Po -- cgit v1.2.3