On Sat, Aug 01, 2020 at 05:40:07PM +0100, Jason McIntyre wrote:
> i'm worried that you're blurring the distinction between asynchronous
> and co-process for the reader. i think that's relevant because, as you
> say, a page like sh(1) does not document co-processes, whereas ksh(1)
> does.
You raise a valid point.

> as i understand it, ksh explains co-processes as a type of asynchronous
> process. and the setting of "!" is applicable to both. is that right?
Correct.  Both background jobs (`&') and co-processes (`|&') are
asynchronous and co-processes are background jobs by definition.

What makes co-processes different is a two-way pipe between them and
the shell, i.e. you can read and write in both directions.

> so could your text be better written as:
> 
>       Process ID of the last background or asynchronous process started.
>       If no processes have been started, the parameter is not set.
> 
> this would catch the setting of "!" for both async and co-process,
> without making the text read like the two are identical.
> 
> if your concern is that you need to be able to /co-process, then i'd
> rewrite the text to not blur the two:
> 
>       Process ID of the last background, co-process, or asynchronous
>       process started.
> 
> but i dislike that, because it means the text suffers because of an
> arbitrary request to make a specific search work.
Indeed, I'd like to have `/co-process<enter>' show it.

> i guess we could add a note to the "Some notes concerning co-processes"
> section if it needs more clarity.
I don't think this is needed.

Background jobs as well as co-processes are async and background jobs or
rather `&' is documented as "asynchronous command" in other places of
the manual, so how about this?


Index: ksh.1
===================================================================
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.209
diff -u -p -r1.209 ksh.1
--- ksh.1       7 Jul 2020 10:33:58 -0000       1.209
+++ ksh.1       1 Aug 2020 16:59:10 -0000
@@ -1247,8 +1247,8 @@ The following special parameters are imp
 set directly using assignments:
 .Bl -tag -width "1 ... 9"
 .It Ev \&!
-Process ID of the last background process started.
-If no background processes have been started, the parameter is not set.
+Process ID of the last background process or co-process started.
+If no asynchronous processes have been started, the parameter is not set.
 .It Ev \&#
 The number of positional parameters ($1, $2, etc.).
 .It Ev \&$

Reply via email to