unset

Official Description

The variables or functions given by the list of names are unassigned.

Syntax

unset [-fv] name ...

Options

-f names refer to functions.

-v names refer to variables.

Oddities

Read-only variables cannot be unset.

Example

$ readonly                   # Display read-only variables
x=17
$
$ unset x                    # Attempt to unset a read-only variable
/bin/ksh: unset: x: is read only
$
$ y=23                       # Create a normal shell variable
$
$ print $y
23
$
$ unset y                    # Remove it with unset
$
$ print $y

$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.