|
|
The C shell, like the Korn shell, uses one file to set up the login environment and a different file to set up environments for every subsequent C shell. In C shell, .login is the file read only at login, and .cshrc is the file read each time a csh is started.
While both the Bourne shell and the Korn shell use Bourne shell startup scripts, the C shell uses C-shell startup scripts, so you will notice that variables are set and tests are performed slightly differently. C-shell scripts do not start with a ``:'' because they are intended for use with C shells, not Bourne shells.
A typical C-shell .login might look something like this:
1 # @(#) login 23.1 91/04/03 2 # 3 # .login -- Commands executed only by a login C-shell 4 # 5 # Copyright (c) 1985-1995 The Santa Cruz Operation, Inc. 6 # All rights reserved. 7 # 8 # This Module contains Proprietary Information of the Santa Cruz 9 # Operation, Inc., and should be treated as Confidential. 10 # 11 setenv SHELL /bin/csh 12 set ignoreeof # don't let control-d logout 13 set path = ($path $home/bin .) # execution search path 14 set noglob 15 set term = (`tset -m ansi:ansi -m :\?ansi -r -S -Q`) 16 if ( $status == 0 ) then 17 setenv TERM "$term" 18 endif 19 unset term noglob 20 /tcb/bin/prwarn # issue a warning if password due to expire
1 # 2 # .cshrc -- Commands executed by the C-shell each time it runs 3 # 4 # @(#) cshrc 3.1 89/06/02 5 # 6 # Copyright (c) 1985-1995 The Santa Cruz Operation, Inc. 7 # All rights reserved. 8 # 9 # This Module contains Proprietary Information of the Santa Cruz 10 # Operation, Inc., and should be treated as Confidential. 11 #12 set noclobber # don't allow '>' to overwrite 13 set history=20 # save last 20 commands 14 if ($?prompt) then 15 set prompt=\!%\ # set prompt string 16 # some BSD lookalikes that maintain a directory stack 17 if (! $?_d) set _d = () 18 alias popd 'cd $_d[1]; echo ${_d[1]}:; shift _d' 19 alias pushd 'set _d = (`pwd` $_d); cd \!*' 20 alias swapd 'set _d = ($_d[2] $_d[1] $_d[3-])' 21 alias flipd 'pushd .; swapd ; popd' 22 endif 23 alias print 'pr -n \!:* | lp' # print command alias