On Sun, Jan 02, 2022 at 06:56:37PM +0000, Jason McIntyre wrote:
> On Sat, Jan 01, 2022 at 11:07:49PM +0100, ?????? wrote:
> > @@ -69,8 +69,8 @@ retaining the prior contents.
> >  .It Fl c Ar command
> >  Run
> >  .Ar command
> > +.Pq via Nm sh Fl c Ar command
> >  instead of an interactive shell.
> 
> or i suppose we could say
> 
>       Run
>       .Nm sh Fl c Ar command ,
>       instead of an interactive shell.
Agree, this is much better phrasing, cheers.

> > -To run a command with arguments, enclose both in quotes.
> why do you want to remove this line? the page is short, and it might
> help someone.
Because the value for -c is a *shell script*, not a command ‒
I didn't think to change it out ‒ it's much more confusing to have this
include mention of arguments when, well, they aren't: this reads as-if
  script -c 'echo a || b'
ran ["echo", "a", "||", "b"] ‒ you can see issue here.

This is in contrast to, e.g., FreeBSD script(1), which has a
  script outfile argv0 argv1 argvn...
usage.

I've applied your phrasing to the first hunk, re-phrased the quoting
requirement, and re-named the Ar name from "command" to "script".
This does introduce a minor ambiguity in that script is heavily loaded
here, but "shell program", while more correct, is not the usual
parlance; dunno ‒ please see scissor-patch below.

P.S.: I forgot to note this in the original patchset,
      but please keep me in CC, as I'm not subscribed.

-- >8 --
Subject: [PATCH v2 4/4] script(1): explicitly specify sh -c,
 rename argument name

The original wording is weird and doesn't explicitly say that it does
sh -c, which is the fundamental point ‒ spell it out directly,
and clear up the quoting requirement: -c takes a shell program,
not a command
---
 usr.bin/script/script.1 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index 28783961a..18802504c 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .Nm script
 .Op Fl a
-.Op Fl c Ar command
+.Op Fl c Ar script
 .Op Ar file
 .Sh DESCRIPTION
 .Nm
@@ -66,11 +66,12 @@ Append the output to
 or
 .Pa typescript ,
 retaining the prior contents.
-.It Fl c Ar command
+.It Fl c Ar script
 Run
-.Ar command
+.Nm sh Fl c Ar script
 instead of an interactive shell.
-To run a command with arguments, enclose both in quotes.
+Scripts longer than just the name of a command need to be quoted,
+and are subject to re-expansion.
 .El
 .Pp
 The script ends when the forked program exits (an
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature

Reply via email to