tcsh problem on 2.0.1
Ron Flax
ron at afsg.apple.com
Tue May 7 03:47:01 AEST 1991
In article <989 at lychee.cs.utexas.edu> ckwang at cs.utexas.edu (Chih-kan Wang) writes:
>I downloaded the compiled tcsh from aux.support.apple.com, put it in /bin,
>edited the /etc/shells, set proper access mode (as the root), and chsh to
>tcsh (in an ordinary user account). Then when I login again and opened
>commandshells, my .login file in home directory didn't get executed. But
>if I changed back to csh, everything went back to normal. Does anybody
>have any similar experience?
>
>The configuration is:
> tcsh 5.18 compiled for AUX 2.0
Well for starters you should probably grab version 5.20.02 from
afsg.apple.com at 192.1.34.2.
Here's what is going on.. tcsh determines that it is a "login shell" by
looking at it's own argc and argv upon execution.
if (argc==1 && *argv[0] == '-')
tcsh is a login shell;
else
tcsh is NOT a login shell;
If tcsh thinks it's a login shell, it processes /etc/csh.login, .tcshrc,
.login, .cshrc, .logout, and /etc/Logout. If it's not a login shell
then it only processes .tcshrc and .cshrc.
That said, here's what is happening... /mac/bin/Login calls tcsh as
follows to start your mac environment:
-tcsh -c /mac/bin/mac32
You can see it sets up *argv[0] ok, but argc=3, not 1. So it's not
considered a login shell and therefore doesn't process the apropriate
dot files.
Now let's say you login to the Console Emulator screen instead of a
32-bit Macintosh environment. Here's what /mac/bin/Login does:
-tcsh
Now both requirements are satisfied, and tcsh thinks it's a login
shell.
To fix things so that tcsh will process your .login file you can trick
the shell by creating a .tcshrc file and placing a line that reads:
source ~/.login
in that file. This will force tcsh to process your .login file. You can
even get a little more specific and only have that occur if the tcsh
process is connected to the console. For instance you could do the
following:
if ( `/bin/tty` == /dev/console ) source ~/.login
Hope this helps you to understand how tcsh is handling startup files.
--
Ron Flax
ron at afsg.apple.com
Apple Federal Systems Group
More information about the Comp.unix.aux
mailing list