SET(1CSH) COMMAND REFERENCE SET(1CSH)
NAME
set, unset - set and unset shell variables (csh built-in)
SYNOPSIS
set [ expression... ]
unset pattern
DESCRIPTION
The set command is used to set and change the values of
csh(1csh) variables. Shell variables can either be single
words or vectors (arrays) of words. If no arguments are
given, the names and values of all shell variables are
printed, with vectors surrounded by parentheses. The
expression arguments may have the following forms:
name The named variable is set to the null string.
name=word The named variable is set to the word given.
The word is subject to substitutions, so
special characters must be escaped or quoted.
name[index]=word
The index'th component of the vector name is
set to the value of word. The component must
already exist.
name=(wordlist)
The named vector is set to the list of values
in the wordlist.
In all cases, variable expansion is done before any
assignment, so the command sequence:
set x=hello
set x=goodbye y=(you say $x)
will set the variable x to ``goodbye'' and the vector y to
``( you say hello )'', not ``( you say goodbye )''.
The unset command is used to delete variables that match the
given pattern. The command unset * unsets all variables.
The following variables have special meaning to the shell.
Of these, argv, cwd, home, path, prompt, shell and status
are always set by the shell. Except for cwd and status this
setting occurs only at initialization; these variables will
not then be modified unless this is done explicitly by you,
the user.
Though shell variables are not environment variables (see
setenv(1csh)), the variables path, and cdpath, are imported
by the shell, and the values of home, term, user, path, and
Printed 4/6/89 1
SET(1CSH) COMMAND REFERENCE SET(1CSH)
cdpath are exported to the environment. The shell variable
path and the environment variable PATH are always maintained
together, whereas cdpath and CDPATH are maintained together
but the values may be changed (see cd(1sh) and cd(1csh) for
more information).
Following is a description of variables which affect built-
in commands:
argv Set to the arguments to the shell, it is from this
variable that positional parameters are
substituted; for example, $1 is replaced by
$argv[1], and so forth.
cdpath Gives a list of alternate directories searched to
find subdirectories in chdir commands. This
variable is maintained along with the CDPATH
environment variable.
complete When set, this variable enables command completion
in interactive shells.
cwd The full pathname of the current directory. See
CAVEATS.
dirname Set to the default directory to change to when the
argument to cd(1csh) or pushd(1csh) is not found
in the current directory or in the list of
directories found in the cdpath variable.
echo Set when the -x command line option is given.
Causes each command and its arguments to be echoed
just before it is executed. For non-builtin
commands all expansions occur before echoing.
Builtin commands are echoed before command and
filename substitution, since these substitutions
are then done selectively. In all cases,
redirection is not taken into account, so the
commands:
set echo
cat /etc/group >& foo
will result in echoing ``cat /etc/group'' to the
original standard error, instead of into the file
``foo''.
hardpaths When symbolic links are followed when changing
directories, the value of the variable cwd and the
values on the directory stack may not be proper
pathnames. When this variable is set, each change
of directory causes the current directory to be
Printed 4/6/89 2
SET(1CSH) COMMAND REFERENCE SET(1CSH)
expanded to not include symbolic links. This
should only be used when accuracy is required, as
it makes directory changes much slower.
histchars Can be given a string value to change the
characters used in history substitution. The
first character of its value is used as the
history substitution character, replacing the
default character !. The second character of its
value replaces the character ^ in quick
substitutions.
history Can be given a numeric value to control the size
of the history list. Any command which has been
referenced in this many events will not be
discarded. Too large values of history may run
the shell out of memory. The last executed
command is always saved on the history list.
home The home directory of the invoker, initialized
from the environment. The filename expansion of
the tilde (~) refers to this variable.
ignoreeof If set, the shell ignores end-of-file from input
devices which are terminals. This prevents shells
from accidentally being killed by <CTRL-D>'s.
list When set to nothing, this variable enables file
and command listing using the ^D character in
interactive mode. If set to `f', filename marking
is turned on. If set to `l', filename marking is
turned on and symbolic links are specially marked.
listpathnum
This modifies the output of file listing (see the
list variable) so that the number of the path
element where each of the commands is found is
printed.
mail The files where the shell checks for mail. This
is done after each command completion, which will
result in a prompt if a specified interval has
elapsed. The shell says You have new mail if the
file exists with an access time not greater than
its modify time.
If the first word of the value of mail is numeric
it specifies a different mail checking interval,
in seconds, than the default, which is 10 minutes.
If multiple mail files are specified, then the
shell says New mail in filename when there is mail
Printed 4/6/89 3
SET(1CSH) COMMAND REFERENCE SET(1CSH)
in filename.
If this variable is not set, no checking for mail
is done.
noclobber As described in the section on Input/output,
restrictions are placed on output redirection to
insure that files are not accidentally destroyed,
and that >> redirections refer to existing files.
noglob If set, filename expansion is inhibited. This is
most useful in shell scripts which are not dealing
with filenames, or after a list of filenames has
been obtained and further expansions are not
desirable.
nonomatch If set, it is not an error for a filename
expansion to not match any existing files; rather
the primitive pattern is returned. It is still an
error for the primitive pattern to be malformed;
for example, echo [ still gives an error.
notify If set, the shell notifies asynchronously of job
completions. The default is to gather present job
completions just before printing a prompt.
path Each word of the path variable specifies a
directory in which commands are to be sought for
execution. A null word specifies the current
directory. If there is no path variable then only
full pathnames will execute. The usual search
path is ., /bin, and /usr/bin, but this may vary
from system to system. For the superuser, the
default search path is /etc, /bin, and /usr/bin. A
shell which is given neither the -c nor the -t
option will normally hash the contents of the
directories in the path variable after reading
.cshrc, and each time the path variable is reset.
If new commands are added to these directories
while the shell is active, it may be necessary to
give the rehash or the commands may not be found.
prompt The string which is printed before each command is
read from an interactive terminal input. If a !
appears in the string it will be replaced by the
current event number unless a preceding \ is
given. Default is % , or # , for the superuser.
savehist is given a numeric value to control the number of
entries of the history list that are saved in
~/.history when the user logs out. Any command
which has been referenced in this many events will
Printed 4/6/89 4
SET(1CSH) COMMAND REFERENCE SET(1CSH)
be saved. During start up, the shell sources
~/.history into the history list enabling history
to be saved across logins. Too large values of
savehist will slow down the shell during start up.
shell The file in which the shell resides.
status The status returned by the last command. If it
terminated abnormally, then 0200 is added to the
status. Built-in commands which fail return exit
status 1, all other built-in commands set status
0.
time Controls automatic timing of commands and time
summary format. If the first value in the vector
is set, then any command which takes more than
this many CPU seconds will cause a time and
resource usage summary to be printed when it
terminates. If the second value in the vector is
set, that value controls the summary format. See
time(1csh) for the summary format values and the
default format.
vbell If set to nothing, command completion errors will
be signaled by the visible bell (:vb:) sequence
from the termcap entry (see termcap(5t)) instead
of the terminal bell. If set to anything else,
the value of the variable is printed.
verbose Set by the -v command line option, causes the
words of each command to be printed after history
substitution.
EXAMPLES
The following command line sets the value of the variable
`Here' to the current working directory, the vector `files'
to the names of the files in the current directory which
begin with the letter `t', and the fourth element of the
variable `junk' to the word ``foo''. If `junk' does not
already exist and have at least four elements, an error
message will result.
set Here="`pwd`" files=( t* ) junk[4]=foo
This example unsets the values of all single-letter
variables.
unset ?
DIAGNOSTICS
name: undefined variable.
An element of the variable name was assigned to, but the
Printed 4/6/89 5
SET(1CSH) COMMAND REFERENCE SET(1CSH)
name has never been assigned.
set: subscript out of range.
An element of a variable was assigned to, but that
element does not exist.
CAVEATS
The value of the variable cwd is not always correct,
especially when symbolic links are followed. If this
variable is required to be correct, the variable hardpaths
should be set.
When command completion or file listing are turned on,
terminal echo mode will always be turned on and the terminal
will always be set to cooked input mode. This is done to
ensure that command completion and file listing behave
properly. If you need to change these terminal
characteristics, you must turn off command completion and
file listing.
SEE ALSO
@(1csh), alias(1csh), bg(1csh), break(1csh), cd(1csh),
chdir(1csh), continue(1csh), csh(1csh), dirs(1csh),
echo(1csh), eval(1csh), exec(1csh), exit(1csh), fg(1csh),
glob(1csh), goto(1csh), hashstat(1csh), history(1csh),
jobs(1csh), kill(1csh), limit(1csh), logout(1csh),
nice(1csh), nohup(1csh), notify(1csh), onintr(1csh),
popd(1csh), pushd(1csh), rehash(1csh), repeat(1csh),
set(1sh), setenv(1csh), sh(1sh), shift(1csh), source(1csh),
stop(1csh), suspend(1csh), time(1csh), umask(1csh),
unhash(1csh), unalias(1csh), unlimit(1csh), unset(1sh),
unsetenv(1csh), wait(1csh), and which(1csh).
Printed 4/6/89 6
%%index%%
na:288,139;
sy:427,250;
de:677,2443;3480,2909;6749,3244;10353,3443;14156,1988;
ex:16144,637;
di:16781,234;17375,165;
ca:17540,689;
se:18229,1548;
%%index%%000000000179