On Sun, Jan 02, 2022 at 11:52:49PM +0000, Jason McIntyre wrote:
> On Sun, Jan 02, 2022 at 11:47:04PM +0100, ?????? wrote:
> > 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 don;t follow. you can run:
>
> $ script -c ls
>
> i.e. a command, not a shell script/
No, "ls" is definitely a shell script. It forks, execps ["ls"], waits,
then exits with WEXITSTATUS() or 128+WTERMSIG().
In many ways this is not that different than if you'd ran
`script -c exec\ ls`, in which case the shell would just execp ["ls"].
> > 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.
> why would you think this? the text just explains that if you have
> command+args you should quote it.
Which means absolutely nothing, because script -c doesn't take a command
or arguments ‒ it takes a shell program as the argument, which either
starts at the next byte, if non-NUL, or is the entire next argument
(XBD 12.1.2.a).
Maybe I'm too hopeful in assuming the baseline of understanding how
shell tokenisation works in the user?
> > -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.
> that's a horrible sentence. i don;t see any improvement.
Sure. Given this and Matthew's post, I've opted to leave both the Ar
name and sentence as-is.
Scissor-patch below.
Also, unrelatedly, does your MUA just completely give up when decoding
UTF-8 and convert each byte to a "?", or?
-- >8 --
Subject: [PATCH v3 4/4] script(1): explicitly specify sh -c
The original wording is weird and doesn't explicitly say that it does
sh -c, which is the fundamental point ‒ spell it out directly
---
usr.bin/script/script.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index 28783961a..857b387b6 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -68,7 +68,7 @@ or
retaining the prior contents.
.It Fl c Ar command
Run
-.Ar command
+.Nm sh Fl c Ar command
instead of an interactive shell.
To run a command with arguments, enclose both in quotes.
.El
--
2.30.2
No comments:
Post a Comment