typeset

NAME

typeset - display or set parameter attributes

SYNOPSIS

typeset [[+-Ulrtux] [-L[n]] [-R[n]] [-Z[n]] [-i[n]] | -f [-tux]] [name[=value] ...]

DESCRIPTION

This command is a Korn-shell built-in command.

The typeset(1) command displays or sets parameter attributes. With no name arguments, parameter attributes are displayed: if no options arg used, the current attributes of all parameters are printed as typeset(1) commands; if an option is given (or - with no option letter) all parameters and their values with the specified attributes are printed; if options are introduced with +, parameter values are not printed.

If name arguments are given, the attributes of the named parameters are set (-) or cleared (+). Values for parameters can optionally be specified. If typeset(1) is used inside a function, any newly created parameters are local to the function.

When -f is used, typeset(1) operates on the attributes of functions. As with parameters, if there are no instances of name given, functions are listed with their values (that is, definitions) unless options are introduced with +, in which case only the function names are reported.

-Ln
Left-justify attribute: n specifies the field width. If n is not specified, the current width of a parameter (or the width of its first assigned value) is used. Leading white space (and zeros, if used with the -Z option) is stripped. If necessary, values are either truncated or space padded to fit the field width.
-Rn
Right-justify attribute: n specifies the field width. If n is not specified, the current width of a parameter (or the width of its first assigned value) is used. Trailing white spaces are stripped. If necessary, values are either stripped of leading characters or space padded to make them fit the field width.
-Zn
Zero fill attribute: if not combined with -L, this is the same as -R, except zero padding is used instead of space padding.
-in
Integer attribute: n specifies the base to use when displaying the integer (if not specified, the base given in the first assignment is used). Parameters with this attribute can be assigned values containing arithmetic expressions.
-U
Unsigned integer attribute: integers are printed as unsigned values (only useful when combined with the -i option). This option is not in the original Korn shell.
-f
Function mode: display or set functions and their attributes instead of parameters.
-l
Lowercase attribute: all uppercase characters in values are converted to lowercase. (In the original Korn shell, this parameter meant "long integer" when used with the -i option).
-r
Read-only attribute: parameters with the this attribute cannot be assigned to or unset. Once this attribute is set, it cannot be turned off.
-t
Tag attribute: has no meaning to the shell; provided for application use. For functions, -t is the trace attribute. When functions with the trace attribute are executed, the xtrace (-x) shell option is temporarily turned on.
-u
Uppercase attribute: all lowercase characters in values are converted to uppercase. (In the original Korn shell, this parameter meant "unsigned integer" when used with the -i option, which meant uppercase letters would never be used for bases greater than 10. See the -U option).

For functions, -u is the undefined attribute. See the section on functions for the implications of this.

-x
Export attribute: parameters (or functions) are placed in the environment of any executed commands. Exported functions are not yet implemented.