Re: interactive shell detection in shrc

<[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
On Mon, Sep 30, 2024 at 12:14:44PM -0700, Greg A. Woods wrote:
> > SHELL is set by ksh and not by sh (sh handles NETBSD_SHELL), if I'm
> > not mistaken?
> 
> login(1) sets $SHELL, and in the BSD world it has done so since 4.2 or
> before.  In the AT&T Unix world it has done so since at least 
> System III, aka UNIX 3.0.
> 

What I mean is that if I'm under ksh, and then I switch to sh even
explicitely setting interactive :

$ printenv

_=/usr/bin/printenv
...
SHELL=/bin/ksh
...

$ sh -i
$ printenv

...
SHELL=/bin/ksh
...

and the same result with "sh -l" (supposed to be considered a login
shell).

So how can the test be reliable in all circumstances?

-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C
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.