aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMateusz Piotrowski <0mp@FreeBSD.org>2021-01-05 15:28:32 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2021-01-05 15:32:27 +0000
commitd41149a8e9cbb76ff89322a3363299f1b93823d2 (patch)
tree4fb77c3e3a9f2b0652f0785ec8fe5d65695a64ed /usr.bin
parent225afb6cad9808af42408875baaa243d6d75d92d (diff)
downloadsrc-d41149a8e9cbb76ff89322a3363299f1b93823d2.tar.gz
src-d41149a8e9cbb76ff89322a3363299f1b93823d2.zip
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
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/script/script.170
1 files 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