tcsh - Shell Variables
tcsh makes a distinction between environment variables and
shell variables.
Environment variables are associated with each process, including your
shell, and inheritted by children. So, for example, when you invoke a
program, such as elm, it inherits all the environment
variables from your shell. Environment variables are accessed with
the setenv and unsetenv commands, and are by
convention given names in upper-case letters, such as PAGER
and EDITOR. Environment variables are used on a
case-by-case basis to communicate user preferences to application
programs. A good example is the newsreader nn, which will
look at the value of the environment variable EDITOR to
determine which text editor a user likes to use.
Shell variables are internal to tcsh only. They are used
to configure the behavoir of various shell commands. Here is a list
of some commonly used shell variables:
- autologout
- The number of minutes of idle time after which the shell
automatically terminates and logs you out. This is a security feature
in case you leave yourself logged in accidentally. To disable, simply
unset the variable.
- history
- The number of previous commands to save in the history buffer.
- ignoreeof
- If set, the UNIX EOF character (CTRL-D) will not
terminate the shell.
- notify
- If set, the shell announces job completions asynchronously. The
default is to preent job completions just before printing a prompt.
- path
- The list of directories in which to look for commands. This is
the same as the evironment variable PATH; changing either
one will update the other one.
- prompt
- The string to use as a command prompt. tcsh uses
escape codes with the "%" key for expansions within the prompt
string. Here are a few of the mor useful ones:
- %/ - current directory
- %~ - current directory, with ~-expansions for home directories
- %l - the tty
- %# - the ">" character, usually used at the end of the prompt
- %n - your username
- %M - hostname
- %m - hostname (short form)
For example, I set my prompt to "%n@%m:%~%# ". This
results in this example prompt "roth@bifur:~> ".
- watch
- A list of user/terminal pairs to watch for logins. This is useful
to have tcsh notify you when someone you know has logged into your
machine.
Mark D. Roth (roth@uiuc.edu)