CHAPTER 5 Shells
Predefined variables used by the C shell include:
set path=(/usr/bin /usr/ucb /usr/local/bin ~/bin . ) # set the path
set prompt = "{'hostname' 'whoami' !} " # set the primary prompt; default is "%"
set noclobber # don't redirect output to existing files
set ignoreeof # ignore EOF (^D) for this shell
set history=100 savehist=50 # keep a history list and save it between logins
# aliases
alias h history # alias h to "history"
alias ls "/usr/bin/ls -sbF" # alias ls to "ls -sbF"
alias ll ls -al # alias ll to "ls -sbFal" (combining these options with those for "ls" above)
alias cd 'cd \!*;pwd' # alias cd so that it prints the current working directory after the change
umask 077
Some new features here that we didn't see in .profile are noclobber, ignoreeof, and history. Noclobber indicates that output will not be redirected to existing files, while ignoreeof specifies that EOF (^D) will not cause the login shell to exit and log you off the system.
With the history feature you can recall previously executed commands and re-execute them, with changes if desired.
An alias allows you to use the specified alias name instead of the full command. In the "ls" example above, typing "ls" will result in "/usr/bin/ls -sbF" being executed. You can tell which "ls" command is in your path with the built-in which command, i.e.:
which ls
ls: aliased to /usr/bin/ls -sbF
A simple .login could be:
# .login
stty erase ^H # set Control-H to be the erase key
set noglob # prevent wild card pattern matching
eval 'tset -Q -s -m ':?xterm'' # prompt for the terminal type, assume "xterm"
unset noglob # re-enable wild card pattern matching
Setting and unsetting noglob around tset prevents it from being confused by any csh filename wild card pattern matching or expansion.
Should you make any changes to your startup files you can initiate the change by sourcing the changed file. For csh you do this with the built-in source command, i.e.:
source .cshrc
For further information about csh type "man csh" at the shell prompt.