jms@tardis.tymnet.com (Joe Smith) (06/29/90)
In article <9122@brazos.Rice.edu> bcsaic!chrise@beaver.cs.washington.edu (Chris Esposito) writes: >has started - my .login file is no longer being read when I login, or so >it seems. I set several environment variables in .login and then use them >in .cshrc. When I log in, the shell complains that OPENWINHOME (the first >of the aforementioned environment vars) is not set. If I `source' the >.login and .cshrc files (in that order) all works fine. You've got it backwards. To see what's really happening, save your .cshrc and .login files, then type 'echo "echo .cshrc" >.cshrc' and 'echo "echo .login" >.login', and make sure both files are owned by your userid. Then when you next login, you will see proof positive that the .login file is read AFTER .cshrc at login time. The .login file is also read when you rlogin to your machine, but it is not when you do an rsh command to your machine (such as "rsh `hostname` date"). The .login file is NOT read when you open up another window under SunView, since it reads the environmental variables from memory instead of from disk. My .cshrc has a short part that is executed every time the csh is started up (including all command scripts that start with "#!/bin/csh") and a longer part that is executed only for an interactive shell. # [several lines deleted] # Ignore the rest of this file when csh is invoked via a pipe. if ($?USER == 0 || $?prompt == 0) exit # The following are definitions suitable for a human at a keyboard. set filec fignore=(.o .out .d) # use the ESCape key for file name completion set notify mail=(15 /usr/spool/mail/$USER) history=500 savehist=500 setenv HOST `hostname`; setenv HOST `basename $HOST .Tymnet.COM` if ("$prompt" == "% " || "$prompt" == "# ") set prompt="$HOST$prompt" if ($?userprompt == 0) set userprompt="${USER}@$prompt" alias tset 'set noglob; eval `\tset -s \!*`' alias header 'echo' # this is redefined in my .suncmd file alias cd 'cd \!*; header ${HOST}:${cwd}; set cwdh=$cwd:h; set prompt="($cwdh:t/$cwd:t) $userprompt"' alias pushd 'pushd \!*; cd .' alias popd 'popd \!*; cd .' if ($?WINDOW_PARENT) then # windows do not execute .login, must do it here source ~/.suncmd # define header, scroll{off,on} using escape sequences # I like non-scrolling cmdtool windows; they have a nicer left margin. if ($term == sun-cmd && `tty` != /dev/ttyp0) then crolloff; tset sun # ttyp0 is the console window endif cd $cwd # This sets the new prompt endif In summary, .login comes after .cshrc execpt for SunView windows. Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms PO Box 49019, MS-C41 | BIX: smithjoe | 12 PDP-10s still running! "POPJ P," San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga speaks for me."
guy@uunet.uu.net (Guy Harris) (07/01/90)
>The .login file is also read when you rlogin to your machine, but it is >not when you do an rsh command to your machine (such as "rsh `hostname` >date"). > >The .login file is NOT read when you open up another window under SunView, >since it reads the environmental variables from memory instead of from >disk. To be precise, the ".login" file is read iff the C shell is fired up with "-" as the first character of "argv[0]", and no other arguments passed to it. "shelltool" and "cmdtool" don't put "-" in front of "argv[0]", and neither does "rshd", which is why the ".login" file isn't read. "login" does put the "-" there. (Similar rules apply to the Bourne and Korn shells; the S5R3.1 Bourne shell, upon which the SunOS 4.x Bourne shell is based, doesn't check whether any other arguments were passed, and checks whether there's a "-" in front of the last component of "argv[0]".)