I just installed 11.3 on a little laptop and I can’t get tcsh to load my .login file.
I set the machine to come up in “runlevel 3” – Multi-User mode, console logins only
I changed my shell to /bin/csh:
% chsh -s /bin/csh
Password:
Shell changed
(/bin/csh is a link to tcsh)
I added some lines to ~/.login:
echo "login IN"
setenv X "asdf"
setenv Y "qwer"
echo "login OUT"
and to .cshrc:
echo "cshrc IN"
alias wert poiu
alias gfsd xnms
echo "cshrc OUT"
There is no ~/.tchrc file.
When I log in, all I see is:
cshrc IN
None of the environment variables are set, and the all aliases are.
The tcsh man page says pretty clearly both these files should be sourced on login, in this order:
- /etc/csh.cshrc
- /etc/csh.login
- ~/.tcshrc or ~/.cshrc
- ~/.history
- ~/.login
- ~/.cshdirs
There is some mention in the man page about the order in which the ~/.login file is sourced, but the version of tcsh here is compiled to source the ~/.login file before the ~/.cshrc file:
% tcsh --version
tcsh 6.17.00 (Astron) 2009-07-10 (i586-suse-linux) options wide,nls,lf,dl,al,kan,sm,color,filec
The “lf” item there is the LOGINFIRST option, which indicates the ~/.login file should be sourced before the ~/.cshrc file, and would change the order listed above, which came from the man page.
I checked “ps” as well, just to make sure I wasn’t in some sub-process. My csh process has a “-” in front of it, which usually means that is a login process.
If I switch back to /bin/sh (a link to bash) and put similar lines in my ~/.profile and ~/.bashrc, they work as expected:
bashrc IN
bashrc OUT
profile IN
profile OUT
So… have I covered all the bases? Is there anything else I should be looking at before I decide tcsh is broken?
There is little substantial difference between bash and tcsh these days. Should I just give up on tcsh and switch to bash?