tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: interactive shell detection in shrc
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
Home |
Main Index |
Thread Index |
Old Index