Csh

.cshrc File       The .cshrc file is run every time you start a new C-Shell, whether you open a new terminal window, run a shell script or just type csh at the prompt. The .cshrc file should hold commands and definitions that you ALWAYS want to run.

.login File       The .login file is run for each login C-Shell you run. A login C-Shell is exactly the same as a regular C-Shell except that the login shell runs the .login file. Usually when you log in, the first shell that is run is a login shell, and subsequent ones (i.e., one run because of shell scripts, etc.) are non-login shells. However, each terminal window you start under the default EWS setup on the workstations runs a login shell.

      Thus, The .login file should contain commands and definitions that you want run ONLY when you log in, for example, setting the terminal type.

Path

      When you are issued your account, the .cshrc file contains only one executed line, which is:

source /usr/local/ews/system.cshrc

      This line calls the file /usr/local/ews/system.cshrc and runs it. This file contains a few environment settings and commands to set up your working environment. Note that this file is not the same throughout all machines in the EWS labs--each type of system (i.e., Sun, HP) has its own /usr/local/ews/system.cshrc, 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.

Modification ****** NOTE : If you modify the .cshrc 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 .cshrc 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/local/ews/system.cshrc file defines an environment variable called ENVIRON to be the ~e 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 source /usr/local/ews/system.cshrc IN YOUR .cshrc FILE FOR THE ENVIRON VARIABLE TO BE DEFINED.******

Example
.cshrc File
      Here's an example of a modified .cshrc 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 into.

#Sample .cshrc file
#
#DON'T REMOVE THIS NEXT LINE!
source /usr/local/ews/system.cshrc
#
#Now that we've done 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
set path=($path /usr/local/bin)
alias plist "ps -aux"
endif
#
#OK, we're all done!
#


For more information on UNIX Shells one can look at:
  • Ksh- EWS Online Manual Page for Ksh
  • Zsh- EWS Online Manual Page for Zsh
  • Tcsh - EWS Online Manual Page for Tcsh
  • Changing your Shell - EWS Online Manual Page for Changing your Shell

Back to the table of contents