Environment variables at login
Christoph Kuenkel
ckl at uwbln.UUCP
Mon Jul 3 18:47:06 AEST 1989
In article <956 at gara.une.oz>, wtoomey at gara.une.oz (Warren Toomey) writes:
> Could anybody tell me where I can put a list of environment variables
> [...] that everybody will get at login, regardless of which shell they login
We use the following scheme:
- each interactive login shell (sh, csh, tcsh, ksh, whatever)
gets a link named ``-<usual name>'' (-sh, -csh, ...)
- the systems bourne shell gets one extra link per login shell
named ``sh-<login shell>'' (sh-csh, sh-tcsh...)
- any users gets one of the bourne shell links as login shell
e.g. user:pw:uid:gid:gecos:home:/bin/sh-csh
- any initialization (not only environment setting) is done
in /etc/profile
- the last statement in /etc/profile overlays the bourne shell
with the real login shell, which is selected using $0
% grep -relevant /etc/profile
if [ $0 = -sh-csh ]; then
SHELL=/bin/csh export SHELL
exec -csh
fi
if [ $0 = sh-csh ]; then
SHELL=/bin/csh export SHELL
exec csh
fi
etc. pp.
# you could use a case statement instead...
the net effect is that any login shell will interpret /etc/profile using
/bin/sh and then start up the real shell which will still believe that its
the login shell (due to the -<name> linkname) [and thus will - for example -
execute ~/.login].
> I've tried putting them in /etc/rc, but for some reason they are not
> passed onto the children process at bootup time.
the shell which executes rc is a child of init just like all the gettys are.
so no environment is passed from rc to gettys :-(
And now my question for the wizards: will the problem of setting up an
uniform process environment for any interactive and/or non-interactive
use be solved in a more elegant fashion in SysVR5 or in some BSD
version?
--
# include <std/disclaimer.h>
Christoph Kuenkel/UniWare GmbH Kantstr. 152, 1000 Berlin 12, West Germany
ck at tub.BITNET ckl at uwbln {unido,tmpmbx,tub}!uwbln!ckl
More information about the Comp.unix.wizards
mailing list