Name

typeset

Synopsis

    typeset [options] [variable[=value ...]]
    typeset -p

In Bash, identical to declare. See declare.

In the Korn shell, assign a type to each variable (along with an optional initial value), or, if no variables are supplied, display all variables of a particular type (as determined by the options). When variables are specified, - option enables the type and +option disables it. With no variables, - option prints variable names and values; +option prints only the names.

The second form shown is specific to ksh93.

Options

-A arr

arr is an associative array. ksh93 only.

-b

The variable can hold any data, including binary data. References retrieve the value printed in base-64 notation; The %B format with printf may be used to print the value. ksh93 only.

-E d

variable is a floating-point number. d is the number of decimal places. The value is printed using printf%g format. ksh93 only.

-f [ c ]

The named variable is a function; no assignment is allowed. If no variable is given, list current function names. Flag c can be t, u, or x. t turns on tracing (same as set -x). u marks the function as undefined, which causes autoloading of the function (i.e., a search of FPATH locates the function when it’s first used. ksh93 also searches PATH). In ksh88, x exports the function. In ksh93, x is accepted but does nothing. Note the aliases autoload and functions.

-F d

variable is a floating-point number. d is the number of decimal places. The value is printed using printf%f format.

Get Unix in a Nutshell, 4th Edition 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.