From: ben@spider.wri.com (Ben Cox) Subject: Re: X with tcsh Date: Wed, 20 May 1992 16:15:20 GMT
(I am answering via news because this could be useful to many people
who may have similar questions.)
(Disclaimer: I don't use Linux yet, because my machine won't arrive
for a week, so I don't know just how much is supported under X386 --
but it sounds like most things are, and most of this is relevant even
it xrdb isn't working. I can't wait to get my machine so I can get
Linux [and later X] running!)
In <1992May20.131406.2204@tc.cornell.edu> elan@cheme.tn.cornell.edu writes:
>tcsh works fine with X, only that when I start an xterm with twm, it doesn't
>seem to read .login - is this normal? How do I make it read .login?
(I haven't used tcsh; I'll assume its startup is similar to csh.)
Ordinarily, csh reads only ".cshrc" on startup, unless it is a "login"
shell, in which case it also reads ".login" (I forget which order they
come in, but you can find out easily enough by putting echo commands
in both and seeing in which order they appear).
An instance of csh finds out whether it is a "login" shell from the
first character of argv[0]: if (*argv[0]) == '-', then it is a login
shell, otherwise it is not.
If you tell twm to start your xterm with the "-ls" switch, then it
invokes the shell as a login shell. If you tell it to start it with
the "+ls" switch, it invokes the shell as a non-login shell (a
subshell). If you don't provide the +/-ls switch, it uses the default,
which, unless you set it otherwise, is "-ls".
You can change the default by specifying it as an X resource using
xrdb or an ~/.Xdefaults file. (If you specify it as a resource
instead of in .Xdefaults, then clients started on other hosts that use
your local display will use the defaults too, otherwise they won't
since they don't have your local ~/.Xdefaults file.)
You can load your ~/.Xdefaults file into the server as a resource by
saying "xrdb -load ~/.Xdefaults". It might be a good idea to include
that line in your xinitrc file. To specify the default for this
feature of xterm, put the following line into .Xdefaults:
XTerm*loginShell: true
I'm not sure why you would want to do this, though, because ordinarily
you don't want every shell to read ".login" (because it's slower to
read both .login and .cshrc than just reading .cshrc). Global things
like exported environment variables (which should be set with "setenv
VAR value" and not "set var=value") should be in .login, and since they
are exported, will be available to non-login shells also (which will
be descendents of the login shell, through twm and X386). Things like
local (unexported) csh variables (set with "set var=value", which is
the difference between set and setenv), prompts and aliases should be
set in the .cshrc file and not in .login, for precisely this reason.
Hope this helps! (I hope you found my blathering useful, and not just
blathering!)