Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2021 13:40:42 GMT
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8c01699f9194 - stable/12 - Add some examples to script.1
Message-ID:  <202101201340.10KDegq8036506@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=8c01699f9194cfa3805ac734ae912529a10c063a

commit 8c01699f9194cfa3805ac734ae912529a10c063a
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2021-01-05 15:28:32 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2021-01-20 13:40:13 +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.
    
    (cherry picked from commit d41149a8e9cbb76ff89322a3363299f1b93823d2)
---
 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 3b67c0341374..d978c2aa2657 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 adfkpqr
+.Op Fl afkqr
 .Op Fl F Ar pipe
 .Op Fl t Ar time
 .Op Ar file Op Ar command ...
+.Nm
+.Fl p
+.Op Fl dq
+.Op Ar file
 .Sh DESCRIPTION
 The
 .Nm
@@ -137,7 +141,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
@@ -163,6 +167,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?202101201340.10KDegq8036506>