Re: interactive shell detection in shrc

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
    Date:        Thu, 26 Sep 2024 15:16:39 -0700
    From:        "Greg A. Woods" <[email protected]>
    Message-ID:  <[email protected]>

  | I'm very curious:  why did you include "m" in that test?

I wondered about that as well.   But I suspect you have
supplied the answer.

  | I do note the following from the bosh(1) manual:
  |
  | 	... POSIX requires that job control is auto-enabled for
  | 	interactive shells ...

It actually requires it to be on by default in interactive shells,
that's almost what the above says, but it could be read as not
allowing "sh +m" to start an interactive shell with job control
disabled -- which is not what posix requires.

  | But I'm pretty sure the key word there is "interactive", which will by
  | definition also mean they have 'i' in $-.

It would, but as you point out -i isn't always available there, but -m
should be, so unless someone actually did run "sh +m" checking for -m
is I guess a way to guestimate that the shell is interactive (-m is,
in practice, almost never turned on or off on the command line, it
just defaults on in interactive shells, and off in others).

kre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.