From owner-dev-commits-src-main@freebsd.org Tue Jan 5 15:32:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBE794E7A53; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9GhK505Tz4cJR; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E1A4686C; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105FWHlJ038292; Tue, 5 Jan 2021 15:32:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105FWH3Q038291; Tue, 5 Jan 2021 15:32:17 GMT (envelope-from git) Date: Tue, 5 Jan 2021 15:32:17 GMT Message-Id: <202101051532.105FWH3Q038291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: d41149a8e9cb - main - Add some examples to script.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d41149a8e9cbb76ff89322a3363299f1b93823d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:32:17 -0000 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