On Wed, Jun 07, 2017 at 01:52:57PM +0200, Joerg Schilling wrote:
> Jilles Tjoelker <jil...@stack.nl> wrote:

> > In interactive mode, job control (-m) is enabled automatically. Some
> > shells, such as FreeBSD sh, dash, mksh and heirloom-sh-050706, allow
> > starting an interactive shell without job control using sh +m, while
> > other shells, such as bash and ksh93, do not (the option is ignored).

> After Stephane pointed to the POSIX standard that includes the same
> text as the ksh man page, I implemented to auto-enable -m in the POSIX
> Bourne Shell (bosh) for interactive shells.

> While doing this, I discovered that the Burne Shell first parses the
> command line options and later decides whether the current shell is
> interactive. For this reason, I do not see that it would be possible
> to use "sh +m" in a useful way.

It is possible to make a distinction between options that are false
because they are explicitly turned off and options that are false
because they have not been mentioned.

> BTW: given that heirloom-sh-050706 is a mostly unmodified Bourne Shell
> from OpenSolaris, it also first parses the options and later decides
> whether it is interactive. So even if it did auto-enable (it does not)
> -m,

>       heirloom-sh-050706 +m

> would be a no-op with respect to the monitor flag.

In my observation it is not a no-op (check the PGID fields):

jilles@lion /home/jilles% jsh 
$ ps jT
USER    PID PPID PGID  SID JOBC STAT TT     TIME COMMAND
jilles 1501 1499 1501 1501    0 Ss    7  0:00.06 zsh
jilles 1505 1501 1505 1501    1 S     7  0:00.00 jsh
jilles 1506 1505 1506 1501    1 R+    7  0:00.00 ps jT
$ %
jilles@lion /home/jilles% jsh +m
$ ps jT
USER    PID PPID PGID  SID JOBC STAT TT     TIME COMMAND
jilles 1501 1499 1501 1501    0 Ss    7  0:00.06 zsh
jilles 1507 1501 1507 1501    1 S+    7  0:00.00 jsh +m
jilles 1508 1507 1507 1501    1 R+    7  0:00.00 ps jT
$ %
jilles@lion /home/jilles%

This is heirloom-sh-050706 from the FreeBSD package, which has only one
source code patch, to turn off shell accounting.

-- 
Jilles Tjoelker

Reply via email to