Up: SGI graphics Frequently Asked Questions (FAQ)
Next: -12- How can I save my screen layout in IRIX 4.0.x?
Previous: -10- What is the difference between .xsession and .sgisession in IRIX 4.0.x?
Subject: -11- Why do 4Dwm, toolchest, Workspace, etc. not recognize an
environment variable I set in my shell's startup files
in IRIX 4.0.x?
Date: 03 Sep 1995 00:00:01 EST
The script /usr/lib/X11/xdm/Xsession (or, if you have one, your own
~/.xsession) runs when you log in and starts your window manager
(4Dwm), Workspace, etc. To give these programs a copy of the
environment you define in your shell's startup files, Xsession first
runs 'userenv', which runs your shell just to see what environment
variables your shell's startup files set and puts them into
Xsession's environment. Later on Xsession runs 4Dwm, Workspace, etc.
and they inherit Xsession's environment including the environment
variables which 'userenv' got from your shell's startup files.
However, 'userenv' objects to 1) errors in your shell startup files,
2) commands which print output to the terminal and 3) commands like
'stty' and 'tset', which expect to be connected to a terminal. Any
of these may cause 'userenv' to give up completely, so that Xsession,
4Dwm, Workspace, etc. do not get any of your shell's enviroment.
To get 'userenv' to work, you must 1) make sure that your shell
startup files are error-free and 2) protect 'userenv' from commands
which print output or expect to be connected to a terminal by testing
for the ENVONLY environment variable before running them. (See the
userenv(1) manpage.) You might try disabling your shell startup files
(or parts thereof) one by one to narrow down which is causing the
problem. Be sure to check both personal and system-wide shell
startup files! See your shell's manpage for a complete list.
Note that each terminal window (aka 'winterm', 'xwsh' or 'xterm')
runs a fresh copy of your shell, so it has a second chance to set
your environment variables. Your shell is now connected to a terminal
and 'userenv' isn't involved, so none of the above problems apply.
The environment in a terminal window will appear correct, and
programs started from a window (e.g. by typing 'workspace' to start
Workspace) will inherit the environment properly. Furthermore,
'userenv' often appears to work when run inside a terminal window,
even when it does not work when run from Xsession. This is all fine,
but it doesn't help when you log in. One right way to see if
'userenv' is working when it should is to add the line 'env >
$HOME/test-userenv' to Xsession after the line that runs 'userenv',
log in and examine the file it creates.
'bash' users take note: 'bash' has particular problems with 'userenv',
and there is a special version of 'userenv' which works with 'bash' at
ftp://viz.tamu.edu/pub/sgi/software/desktop/userenv.tar.gz.
Up: SGI graphics Frequently Asked Questions (FAQ)
Next: -12- How can I save my screen layout in IRIX 4.0.x?
Previous: -10- What is the difference between .xsession and .sgisession in IRIX 4.0.x?