The POSIX shell built-in unset removes the specified shell function or shell variable from the current environment.
The built-in environment variables IFS, MAILCHECK, PATH, PS1, and PS2 cannot be deleted using unset.
Syntax
unset[ -f][ -v] name... |
If option -f is specified, name refers to a shell function.
If option -v is specified, name refers to a shell variable. Read-only shell variables cannot be deleted. If neither -f nor -v is specified, name refers to a shell variable. If there is no variable with a corresponding name then it is possible that any function having the same name may be deleted.
Name of the shell variable or function to be removed from the current environment. Several blank-separated names may be specified in a single command line. |
Exit status
0 | All shell variables or shell functions have been successfully deleted. |
>0 | At least one shell variable or shell function could not be deleted. |
Locale
The following environment variables affect the execution of unset: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
Example
Remove the shell function ll:
|
See also
set |