Date: Tue, 5 Jan 2021 15:32:17 GMT From: Mateusz Piotrowski <0mp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d41149a8e9cb - main - Add some examples to script.1 Message-ID: <202101051532.105FWH3Q038291@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d41149a8e9cbb76ff89322a3363299f1b93823d2 commit d41149a8e9cbb76ff89322a3363299f1b93823d2 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-05 15:28:32 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-05 15:32:27 +0000 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101051532.105FWH3Q038291>