source: trunk/debathena/debathena/dotfiles/cshrc @ 25593

Revision 25593, 6.4 KB checked in by jdreed, 12 years ago (diff)
- Don't use Bourne variable syntax in csh - Use the same idiom in both shells - Use a variable for all messages to avoid duplication
  • Property svn:executable set to *
RevLine 
[17853]1# Global cshrc file
2#
[22667]3# $Id: cshrc,v 1.12 2007-08-22 18:12:33 ghudson Exp $
[17853]4
5# This file is sourced by default user file ~/.cshrc
6
7
[22913]8set initdir=/usr/lib/init
[17853]9
[25097]10# Determine if we're in an sftp or scp session, and if so, be quiet
11set SILENT=no
12if ($?command) then
[25100]13  switch ("$command")
[25364]14    case '*/usr/lib/openssh/sftp-server':
[25097]15      set SILENT=yes
16      breaksw
[25100]17    case 'scp *':
[25097]18      set SILENT=yes
19      breaksw
20  endsw
21endif
22
[17853]23# *******************   ENVIRONMENT SETUP   *******************
24
25# Compatibility with older versions of Athena tcsh
26set autolist=""
27if ($?tcsh) then
28  bindkey "^W" backward-delete-word
29  bindkey "^Z" complete-word
30  bindkey " " magic-space
31
32endif
33
[19645]34# Set host type and hostname variables.
[22913]35if (! $?ATHENA_HOSTTYPE) setenv ATHENA_HOSTTYPE "`/bin/machtype`"
[19645]36if (! $?HOST) setenv HOST "`hostname`"
37setenv HOSTTYPE "$ATHENA_HOSTTYPE"
38set hosttype=$HOSTTYPE
39set host=$HOST
40
[17853]41# Set up standard system/user environment configuration (including setup of
[22940]42# environment variables, attachment of lockers, and additions to search path)
[17853]43
44if (! $?ENV_SET) then
45
46  setenv ENV_SET                                # Avoid unnecessary repeat
47
[24770]48  # Ensure user's homedir is attached, for legacy things
49  # that care about attachtab
[24792]50  # Only attach if running as an Athena user, not e.g. using sudo.
[24793]51  if ( $?DEBATHENA_HOME_TYPE ) then
52    if ( $DEBATHENA_HOME_TYPE == afs ) then
53      if ( $?ATHENA_USER ) then
[24795]54        /bin/attach -h -q "$ATHENA_USER"
[24793]55      else
[24795]56        /bin/attach -h -q "$USER"
[24793]57      endif
58    endif
[24792]59  endif
[24770]60
[22975]61  if (-r ~/.generation) then
62    setenv ATHENA_DOTFILE_GENERATION `cat ~/.generation`
63  else
64    setenv ATHENA_DOTFILE_GENERATION 0
65  endif
66
[17853]67  limit coredumpsize 0                  # Don't allow coredumps
68  setenv MORE -s                        # Default "more" behavior
69                                        # we are now down to -s
70                                        # because -d is wrong.
71  setenv EDITOR emacs                   # Set default editor
72  setenv MM_CHARSET iso-8859-1
73
[23438]74  setenv EMAIL "$USER@mit.edu"          # Set default email address
75
[22913]76  setenv ATHENA_SYS `/bin/machtype -S`
[17853]77  if ( $ATHENA_SYS == "" ) then
78    setenv ATHENA_SYS @sys
79  endif
[22913]80  setenv ATHENA_SYS_COMPAT `/bin/machtype -C`
[17853]81
82  set bindir=arch/${ATHENA_SYS}/bin
83
[23132]84  if ( ! $?PRINTER && -e /var/run/athena-clusterinfo.csh ) then
85    setenv PRINTER `awk '/LPR/ { print $3 }' /var/run/athena-clusterinfo.csh`
[17853]86    if ( $PRINTER == "" ) unsetenv PRINTER
87  endif
88
89  # Reset the "home" and HOME variables to correspond to the actual
90  # location of the user's home directory.  This will avoid having
91  # long pathnames being printed when /mit/<user> is a symlink to a
92  # path within AFS.
93
[22667]94  set x=`(cd && /bin/pwd)`
[17853]95  if ("$x" != "") then
[22667]96    set home=$x
97    if ("$x" == "`/bin/pwd`") then
98      set cwd=$x
99    endif
[17853]100  endif
101  unset x
102
[23842]103  # NOTE:
104  # The use of the "extend", "sextend", and "textend" aliases in
105  # ~/.environment is no longer supported.  Consult the Athena
106  # documentation on Dotfiles for supported dotfile operations
[23049]107
[17853]108  # Run user environment customizations identified in your
109  # ~/.environment file.  This is the place to include your own
110  # environment variables, attach commands, and other system wide
111  # setup commands.  You can also cancel default behaviors listed
112  # above with "unsetenv" or "setenv".  ~/.environment is not sourced
113  # if NOCALLS is set (i.e., if you selected the xlogin "Ignore your
114  # customizations" option when you logged in).
115
[25097]116  if ((! $?NOCALLS) && (-r ~/.environment)) then
117    if ( $SILENT == "yes" ) then
[25098]118      source ~/.environment >&/dev/null
119    else
[25097]120      source ~/.environment
121    endif
122  endif
[17853]123
[23842]124  # NOTE:
125  # .path files are no longer supported, consult Athena documentation
126  # for the correct way to specify your PATH
127 
128  # Standard Athena path additions.
129  set path=(`/usr/bin/athdir $HOME` $path .)
[23049]130
[17853]131endif
132
133# Set appropriate bin directory variable for this platform
134# (e.g., vaxbin for VAXstations, decmipsbin for pMAXen, etc.;  this will
135# be included in actual searchpath as ~/$bindir -- e.g., ~/vaxbin):
136set bindir=arch/${ATHENA_SYS}/bin
137
138# *******************  C SHELL SETUP   *******************
139
140# Set up standard C shell initializations
141
142set noclobber                   # Don't overwrite files with redirection
143
144if ($?prompt) then              # For interactive shells only (i.e., NOT rsh):
145  set interactive               #   Provide shell variable for compatability
146endif
147
148# Set up standard C shell aliases
149
150if ($?XSESSION) then
[25379]151  if ( -x /usr/bin/gnome-session-quit ) then
152    alias logout        'exit && gnome-session-quit --no-prompt'        # logout for X
153  else
154    alias logout        'exit && gnome-session-save --kill --silent'    # logout for X
155  endif
[17853]156endif
157
158#   aliases dealing with subjects
159alias setup_X '( setenv SUBJECT \!:1 ; ( xterm -title \!* & ) )'
160alias setup_tty '( setenv SUBJECT \!* ; $SHELL )'
161if ($?XSESSION) then
162  alias setup setup_X
163else
164  alias setup setup_tty
165endif
[23782]166alias remove 'setenv SUBJECT \!* ; source $initdir/env_remove ; unsetenv SUBJECT'
[17853]167
168# If this is a subject window, run the env_setup script
169if (($?SUBJECT) && (-r $initdir/env_setup)) source $initdir/env_setup
170
171
172# All of the C shell initializing commands above can be overridden by
173# using "unset" or "unalias" commands (or by changing things using
174# "set" or "alias" again) in your ~/.cshrc.mine file, which is sourced
175# here.  ~/.cshrc.mine is not sourced if the xlogin "Ignore your
176# customizations" option was selected to begin the session.
177
[25097]178if ((! $?NOCALLS) && (-r ~/.cshrc.mine)) then
179  if ( $SILENT == "yes" ) then
[25098]180    source ~/.cshrc.mine >&/dev/null
181  else
[25097]182    source ~/.cshrc.mine
183  endif
184endif
[25590]185
186if (! $?skip_sanity_checks) then
[25593]187  set missing=0
188  echo $path | /usr/bin/tr ':' '\n' | /bin/grep -Fqx /bin
[25590]189  if ( $? != 0 ) then
[25593]190    set missing=1
[25590]191  endif
[25593]192  echo $path | /usr/bin/tr ':' '\n' | /bin/grep -Fqx /usr/bin
[25590]193  if ( $? != 0 ) then
[25593]194    set missing=1
[25590]195  endif
196  if ( $missing == 1 ) then
[25593]197    set text="You appear to have incorrectly modified your PATH variable in your dotiles,\nand as such have deleted /bin and/or /usr/bin from your PATH, which\nwill likely cause this login session to fail.  Please correct this problem.\nThis warning can be disabled by setting the skip_sanity_checks variable."
[25590]198    echo "$text" > /dev/stderr
199    if ( $?DISPLAY) then
200      /usr/bin/zenity --warning --text="$text"
201    endif
202  endif
203  if ( $?LD_ASSUME_KERNEL ) then
204    unsetenv LD_ASSUME_KERNEL
[25593]205    set text="Setting LD_ASSUME_KERNEL in your dotfiles is a bad idea.\nIt has been unset for you.\nSet the skip_sanity_checks variable if you really wanted it."
206    echo "$text" > /dev/stderr
[25590]207    if ( $?DISPLAY) then
[25593]208      /usr/bin/zenity --warning --text="$text"
[25590]209    endif
210  endif     
211endif
Note: See TracBrowser for help on using the repository browser.