Delete the names matching the given patterns from the symbol table. The pattern may contain the following special characters:
?
- Match any single character.
*
- Match zero or more characters.
[
list]
- Match the list of characters specified by list. If the first character is
!
or^
, match all characters except those specified by list. For example, the pattern ‘[a-zA-Z]’ will match all lower and upper case alphabetic characters.For example, the command
clear foo b*rclears the name
foo
and all names that begin with the letterb
and end with the letterr
.If
clear
is called without any arguments, all user-defined variables (local and global) are cleared from the symbol table. Ifclear
is called with at least one argument, only the visible names matching the arguments are cleared. For example, suppose you have defined a functionfoo
, and then hidden it by performing the assignmentfoo = 2
. Executing the command clear foo once will clear the variable definition and restore the definition offoo
as a function. Executing clear foo a second time will clear the function definition.The following options are available in both long and short form
With the execption of
-all, -a
- Clears all local and global user-defined variables and all functions from the symbol table.
-exclusive, -x
- Clears the variables that don't match the following pattern.
-functions, -f
- Clears the function names and the built-in symbols names.
-global, -g
- Clears the global symbol names.
-variables, -v
- Clears the local variable names.
-regexp, -r
- The arguments are treated as regular expressions as any variables that match will be cleared.
exclusive
, all long options can be used without the dash as well.