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 08:39:47PM +0000, RVP wrote:
> [...]
> On Mon, 30 Sep 2024, tlaronde%kergis.com@localhost wrote:
>
> > 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?
> >
>
> Set SHELL explicitly?
>
But, if I'm not mistaken, the discussion was about testing if a shell
is interactive, that is, "inheriting" whatever has been set and
testing it. Since SHELL is not set by all login programs (your
example of xterm) and since the variable, if redefined or undefined,
is not set automatically by all shells, it can not be used neitherto
identify the shell and nor to use reliably to verify that it is
an interactive session.
Or have I misread something?---it could perfectly be the case...
--
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