Hamilton LaboratoriesHamilton C shell 2012User guideLanguage reference


Oregon Coast

Previous | Next


Default login.csh
Overriding the default
See also


The C shell looks for a login.csh file if it's started with the -L option indicating that it’s a login shell. The search order is to look first in the user’s ~ home directory, then in the C shell’s distribution directory for the default.

Because login.csh is useful for setting up environment variables, login.csh is read before startup.csh.

Default login.csh

This is the default login.csh file in the distribution directory.

#  Hamilton C shell(tm) 2012
#  Login.csh Release 5.1.a

#  This is the default login.csh file.  The Hamilton C shell looks for
#  this file first in your home directory and then in its distribution
#  directory if you start it with -L.

#  You can override this by creating your own login.csh in your home
#  directory.  If all you'd like to do is add your own additional
#  statements, the easiest way to do that is to source this default
#  login.csh file at the start of the one in your home directory:
#     source $shell:h:h\login.csh

#  Blank lines are ignored; anything following a "#" on a given line is
#  considered a comment.

local savehashing
@ savehashing = nohashing
@ nohashing = 1
local cshdir, i

#  Setup the search path, adding the ".", bin and samples directories
#  if they're not already on the path.

set cshdir = $shell:h:h

$cshdir\samples\memberi > nul  # just to load the member proc

foreach i ( $cshdir\{Samples,Bin} )
   if ( ! memberi( i, path ) ) set path = $i $path
if ( path[ 0 ] != "." ) set path = . $path

@ nohashing = savehashing
unlocal savehashing

#  If the SwitchChars variable isn't set, set it to a hyphen
#  as the only command line option switch character.

if (! $?SwitchChars) setenv SwitchChars = -

#  If tabs isn't defined, set it to be 3
if ( ! $?tabs ) setenv Tabs = 3

#  Setup the cdpath variable, if it's not already defined, to allow
#  quick cd's into the user's home directory and desktop directories.

if ( $#cdpath == 0 ) then
   set cdpath = $home ``directory desktop`` ``directory -a desktop``
unlocal cshdir, i

set     savehist  = 0
set     ignoreeof = 1

Overriding the default

The C shell runs the default login.csh only if you don't have one in your HOME directory. So the easiest way to easiest way to override the default is to create a login.csh in that directory and put whatever you like in it, including copying and pasting only just those parts of the default login.csh you like.

If you mostly like the default login.csh but would add or change only a few things, source the default default login.csh but then override parts of it.

Here's how to source the default login.csh without having to know where it is.

source $shell:h:h\login.csh

The $shell variable returns the filename of the C shell executable that's running, e.g., C:\Program Files\Hamilton C shell 2012 x64\Bin\csh.exe. The :h editing operator returns the parent directory. $shell:h:h is the root of C shell's install directory, C:\Program Files\Hamilton C shell 2012 x64.

See also

Customizing the shell
C shell command line options
Environment variables
Predefined variables

Previous | Next