rc   [plain text]


##
# TCSH Expanded C-Shell INITIALIZATION FILE
#
# Wilfredo Sanchez Jr. | tritan@mit.edu
# July 09, 1992
#
# MIT Project Athena
#
# ORIGINAL SOURCES: /usr/athena/lib/init/cshrc (ATHENA REL 7.3P)
##

set default_tcsh_initdir = /usr/share/tcsh/examples/
set user_tcsh_initdir    = ~/Library/init/tcsh

if (-r "${user_tcsh_initdir}") then
  set tcsh_initdir = "${user_tcsh_initdir}"
else
  set tcsh_initdir = "${default_tcsh_initdir}"
endif

# SET UP HOST-DEPENDENT VARIABLES, ETC.
set host = `hostname`
set host = `echo $host | tr A-Z a-z`

set user=`whoami`

setenv HOST "${host}"
setenv USER "${user}"

# User ID (csh doesn't set $uid, tcsh does)
if (! $?uid) set uid = `id | cut -d = -f 2 | cut -d \( -f 1`

# MISCELLANEOUS SETS
if (! $?version) set version = "unknown"

# Non-root users
if ($uid) then
  unset autologout
else
  # Avoid closing of Terminal windows when logged in as root
  if ($?TERM_PROGRAM && $?SHLVL) then
    if ("$SHLVL" == "1") unset autologout
  endif
endif

# ENVIRONMENT SETUP

if ($?prompt) set interactive

if (-r "${default_tcsh_initdir}/tcsh.defaults") then
    source "${default_tcsh_initdir}/tcsh.defaults"
endif

if (! $?ENV_SET) then	# Top-most shell
  if (-r "${default_tcsh_initdir}/environment" && ($?prompt || $?XSESSION)) then
    source "${default_tcsh_initdir}/environment"
  endif
else  			# NON ENV_SET, 2nd+ shells
  # noop
endif

# DEFAULT KEY BINDINGS
if ($?interactive) then
  if ("${version}" =~ "tcsh"*) bindkey "^R" i-search-back
endif

# DEFAULT LOGIN SOURCES
if (-r "${tcsh_initdir}/rc.mine") source "${tcsh_initdir}/rc.mine"

if ($?interactive) then
  # These aren't useful for non-interactive sessions
  if (-r "${default_tcsh_initdir}/aliases" && ! $?noalias) then
    source "${default_tcsh_initdir}/aliases"
  endif
  if (-r "${default_tcsh_initdir}/completions" && ! $?noalias && $?version) then
    if ("$version" =~ tcsh*) source "${default_tcsh_initdir}/completions"
  endif
endif