<tt>.login</tt> and <tt>.cshrc</tt>: C Shell Login Files



next up previous contents
Next: .logout: Leaving UNIX Up: Special Files Previous: Special Files

.login and .cshrc: C Shell Login Files

As seen above, the order in which the files are executed on logging in to a Sun differs slightly from that of a Silicon Graphics system.

Although the order of execution of the .login file on a Sun and on an SGI differs, their content is very similar. Table 15.1 should help you decide what to put in which file.

  
Table 15.1: .cshrc and .login File Content

The following few examples show how definitions can be put into the .cshrc and .login files:

  1. On Suns, some users like to go directly into their windowing system at logon time. The following text in the .login file would accomplish this, but only if they are logging on from the workstation's console:
        # if the device I'm logging into is not the console, stop here.
        if ("\,`tty`\," != "/dev/console") exit
        sunview
  2. The same example could be used, but a five second interval given to the user to stop execution of .login so that sunview is not called.
        # if the device I'm logging into is not the console, stop here.
        # if it is the console, give me five seconds to stop execution.
        if ("\,`tty`\," != "/dev/console") exit
        echo -n "Sunview? (\^{ }C to interrupt)"
        sleep 5
        sunview
        logout
  3. Global environment variables such as path and MANPATH:
        # this system has a local directory for man pages. 
        setenv MANPATH /usr/local/catman:/usr/catman
        
        # path definition.  Note the ($path) in the second line
        set path = (. ~/bin /usr/bsd /bin /usr/bin /usr/sbin /usr/local/bin)
        set path = ($path /usr/bin/dn /usr/local/tex/bin)
  4. Local variables such as your own prompt:
        # setup your prompt.
        set prompt = "! system> "  (C shell) 
        set prompt = "%! %~ > "  (Tenex shells)
    The first gives history number, followed by the string system>, whereas the second gives history number, and directory path of current directory.
  5. To enable the history features:
        set history = 40
        set savehist = 40
  6. To set up some aliases:
        alias ls ls -C
        alias bye logout



Super-User
Fri Feb 17 15:55:40 EST 1995