typeset
[
options
] [
variable
[
=
value
...]]
typeset -p
Korn shell only. 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 given, -
option
prints variable names and values; +option
prints only the names.
The second form shown is specific to ksh93
.
-A
arr
arr
is an associative array. 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
d
variable
is a floating-point number. d
is the number of decimal places. The value is printed using printf
%f
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). x
exports the function. Note the aliases autoload
and functions
.
-H
On non-Unix systems, map Unix filenames to host filenames.
-i
[n
]
Define variables as integers of base n
. integer
is an alias for typeset -i
.
-L
[n
]
Define variables as left-justified strings, n
characters long (truncate or pad with blanks on the right as needed). Leading blanks are stripped; leading 0s are stripped if -Z
is also specified. If no n
is supplied, field width is that of the variable's first assigned value.
-l
Convert uppercase to lowercase.
-n
variable
is an indirect reference to another variable (a nameref
). ksh93
only. (See the section "Variables," earlier in this chapter.)
-p
Print typeset
commands to recreate the types of all the current variables. ksh93
only.
-R
[n
]
Define variables as right-justified strings, n
characters long (truncate or pad with blanks on the left as needed). Trailing blanks are stripped. If no n
is supplied, field width is that of the variable's first assigned value.
-r
Mark variables as read-only. See also readonly
.
-t
Mark variables with a user-definable tag.
-u
Convert lowercase to uppercase.
-x
Mark variables for automatic export.
-Z
[n
]
When used with -L
, strip leading 0s. When used alone, it's similar to -R
except that -Z
pads numeric values with 0s and pads text values with blanks.
typeset List name, value, and type of all set variables
typeset -x List names and values of exported variables
typeset +r PWD End read-only status of PWD
typeset -i n1 n2 n3 Three variables are integers
typeset -R5 zipcode zipcode is flush right, five characters wide