unset - Unset values and attributes of variables and functions
Format
unset name ...
unset -fv name ...
tcsh shell: unset pattern
Description
Calling unset with no options removes the value and attributes of each variable or function name.
In the tcsh shell, unset removes all variables whose names match
pattern, unless they are read-only. For example:
unset *
which we strongly
recommend you do not do, will remove all variables unless they are read-only. It is not an error for
nothing to be unset. For more information, see tcsh - Invoke a C shell.Options
- -f
- Removes the value and attributes of each function name.
- -v
- Removes the attribute and value of the variable name. This option is the default if no options are specified.
unset cannot remove names that have been set read-only.
Usage notes
unset is a special built-in shell command.
Localization
unset uses the following localization environment variables:
- LANG
- LC_ALL
- LC_MESSAGES
- NLSPATH
Exit values
0
- Successful completion.
1
- Failure due to an incorrect command-line option.
2
- Failure due to an incorrect command-line argument.
Otherwise, unset returns the number of specified names that are incorrect, not currently set, or read-only.
Messages
Possible error messages include:
- name readonly variable
- The given name cannot be deleted because it has been marked read-only.
Portability
POSIX.2, X/Open Portability Guide.
Related information
readonly, sh, tcsh