next up previous contents
Next: Array Variables Up: Variables Previous: Variables

User Defined Variables

User defined variables are local to the current shell, and are defined by the user (as the name states). To set a user defined variable, the user would use the set command which has the following syntax for assigning a value to a variable:

set variable_name=value

such as

% set MY_ADDRESS=''''
% echo ``E-mail me at $MY_ADDRESS''
E-mail me at

To see a listing of all of the currently set variables (both local and global), the set command can be used with no arguments. For example, a typical session might give the following:

% set
cdpath      /usr/spool
cwd         /home/buchanan/book/cshell
history     40
home        /home/buchanan
path        (/bin /usr/bin /usr/local/bin usr/X11/bin .)
prompt2      %m:%#
shell       /bin/csh
user        /buchanan

All of the lower cased variables are environmental variables that will be covered shortly. To remove a variable from use, the unset command can be used. The unset command followed by a name (or wildcard expression) will remove the variable(s).

Douglas M Gingrich
Mon Apr 27 15:25:49 MDT 1998