Your .login File


The .login file that is issued with your EWS account contains only one executed line:

source /usr/local/ews/system.login

      The file /usr/local/ews/system.login contains commands to set up your terminal and perform a few other tasks needed when a login shell is run.

      Changing your .login file carries the same precautions as changing your .cshrc file. You MUST take into account different system types, and the environment variable ENVIRON will help you do that. See the above section for an example of using the ENVIRON variable under C-Shell to account for differences in systems.

Korn Shell       If you are using the Korn Shell, there is only one file that is immediately relevant. This file is the ~/.profile file. This file is run only for login shells, that is, a shell which is run when you first log in or when you create a new terminal window under XWindows. Shells that are run when you run a shell script or simply type ksh at the prompt are not login shells and do not run the .profile file. The .profile file issued with your EWS account contains only one exe cuted line:

. /usr/local/ews/system.profile This command executes the commands and definitions found in the file /usr/local/ews/system.profile These commands set up the working environment. Note that this is not the same throughout all machines in the EWS labs - each type of system (i.e., Sun, or HP) has its own /usr/local/ews/system.profile , so if you log into a Sun, you do not run the same file as when you log into an HP. These different files allow us to account for minor differences in the various operating systems.

      If you modify the .profile file, you must be careful to take into account differences between the different systems. Failure to do so can result in problems using a particular type of system.

      In other words, do not place HP-specific commands in your .profile file, for if you ever log into a Sun system, you may find that the command either does not work at all or does not have the same effect or, even worse, has a destructive effect.

      To account for these differences, the /usr/lo cal/ews/system.profile file defines an environment variable called ENVIRON to be the type of system you are running on. It can take values of SUN or HPUX, depending on what type of system you are using.

****** NOTE : YOU MUST LEAVE THE LINE . /usr/local/ews/system.profile IN YOUR .profile FILE FOR THE ENVIRON VARIABLE TO BE DEFINED.******

      Here's an example of a modified .profile file. In this file, the user wishes to make changes to his path and create a few aliases, but, because of differences in machines, he must take into account which machine he is logging in to.

#Sample .profile file
#
#
#DON'T REMOVE THIS NEXT LINE!
. /usr/local/ews/system.profile
#
#Now that we're done with the system-specific stuff, we can
#add our own commands.
#
#If we're on a Sun system, we want to be able to use
#Common LISP and define plist to give a full process list.
#
if [ $ENVIRON = SUN ]; then export
PATH=$PATH:/local/apps1/cl
alias plist="ps -ef"

#OK, we're all done!
#

Customizing
non-login
Korn shells
      The .profile file is fine for customizing login Korn shells, but what does one do with shells which are not login shells? The C-Shell uses the .cshrc file for this purpose, but there is no "standard" equivalent file under the Korn shell. Rather, Korn shell lets you define your own file to be run under non-login shells.

      When a Korn shell is started, it will run the user's .profile file if it is a login shell. After that, whether it is a login shell or not, it will look at the environment variable ENV. If this variable contains the name of a valid file, it will b e run - otherwise the shell merely continues.

      To get similar functionality as with C-Shell, you need to define the ENV variable in your .profile to point to a file which contains commands and definitions that you want all Korn shells to execute. The most common name for this file is ~/ .kshrc , so you would need to put:

export ENV= ~/.kshrc

into your .profile file (after the line that calls the system-wide profile).


For more information on .login one can look at:
  • Csh - EWS Online Manual Page for Csh
  • Csh - EWS Online Manual Page for Ksh

Back to the table of contents