The unset built-in undefines variables or functions.


  • unset [-fv] [name…]


The unset built-in removes the definition of the variables or functions specified by operands.

It is not an error if any of the specified variables or functions do not exist; they are silently ignored.



Undefine functions.


Undefine variables.

These options are mutually exclusive: only the last specified one is effective. If neither is specified, -v is assumed.



The name of a variable or function to be undefined.

Exit status

The exit status of the unset built-in is zero unless there is any error.


The unset built-in is a special built-in.

Although yash does not do so, the POSIX standard allows removing a function if neither of the -f and -v options is specified and the specified variable does not exist.

At least one name operand must be specified in the POSIXly-correct mode.