Invoking typeset with no options displays a list of
all KornShell variables showing their names, values, and attributes.
This list is sorted by variable name and includes quoting so that it can
be re-input to the KornShell with the built-in command eval.
When only arguments of the form
If the command line contains at least one name,
the attributes of each specified name are changed.
In this case, parameters of the form
When typeset is invoked inside a function, a new instance of each name is created. After the function terminates, each name is restored to the value and attributes it had before the function was called.
The declare utility behaves similarly to the typeset utility except that when no options or arguments are specified, declare lists all shell variables with their values (but not their attributes) as well as all functions with their definitions (but again not their attributes).
The local utility can only be used within a function and specifies that variable name is local to that particular function and its children. An error occurs if you use local outside a function. When no options or arguments are specified, local does nothing and returns.
does not display function definitions. Only function names and attributes are displayed. This option implies
If you specify only the
-for -Foption but no arguments, typeset and declare list all defined functions in the environment. (with definitions for typeset but without definitions for declare). You can combine this with the -uoption to list all undefined functions. -H
performs POSIX to host-name file mapping. For example, on Windows systems, slashes are mapped to backslashes. If the
-hoption is currently turned on, this option turns it off. -h
performs host-name to POSIX file mapping. For example, on Windows systems, slashes are mapped to backslashes. If the
-Hoption is currently turned on, this option turns it off. -i[number]
marks each variable as an integer value, making arithmetic faster. If number is given and non-zero, the output base of each name is number.
-L, -R, and -Zoptions do not work with integer variables. -I
handles names in a case-insensitive manner. With this option, Var , var, and VAR all refer to the same variable. If two or more variables exist which, when the command is issued, have the same name as name, typeset issues an error message.
converts uppercase characters to lowercase in any value assigned to a name. If the
-uoption is currently turned on, this option turns it off. -P
marks the variables as having a value which is interpreted as a path name or a list of path names separated by colons or semicolons. While their values are always stored internally in Windows format, such variables can have their values displayed in either Windows or UNIX format. The output format depends upon whether or not the variable has the
-Hproperty set, whether or not the Enhanced UNIX Compatibility Mode is on, and the setting of the TK_PATH_CONVERT environment variable.
-Hproperty is set, the output format is Windows format. When -His not set and the Enhanced UNIX Compatibility Mode is on, the output format is UNIX format with virtual file system path names. When the -Hproperty is not set and the Enhanced UNIX Compatibility Mode is off, the output format uses Windows path names with /x=/ used in place of x:/ to specify drive letters and : used as the directory separator. In all other situations, the output is in Windows format. -p
causes the output generated by typeset or declare to be in a form that is suitable for use as input to the shell for setting variables.
If you specify the
-poption with no other options or arguments, the result is similar to specifying no options or arguments whatever, except that the output is in a form suitable for use as input to the shell.
Similarly, if you specify the
-poption with only the -for -Foption but no arguments, only defined functions are listed (with definitions for typeset but without definitions for declare). Again, this is in a form suitable for use as input. You can list all undefined functions by adding the -uoption. -r
makes each name read-only. See readonly.
tags each name. Tags are user-defined and have no meaning to the shell. For functions (with the
-foption), this turns on the xtraceoption. See set for a discussion of the xtraceoption. -u
converts lowercase characters to uppercase in any value assigned to a name. If the
-loption is currently turned on, this option turns it off.
When used with
-f, -uindicates that the functions named in the command line are not yet defined. The attributes specified by the typeset command are applied to the functions once they are defined. See the functions reference page for a full description of undefined functions and the autoload alias. -x
sets each name for automatic export. See export.
The following three options justify, within a field, the values assigned to each name. The width of the field is number if it is defined and non-zero; otherwise, the width is that of the first assignment made to name.
left justifies the values assigned to each name by first removing any leading blanks. Leading zeroes are also removed if the
-Zoption has been turned on. Blanks are added on the end or the end of the value is truncated as necessary. If the -Roption is currently turned on, this option turns it off. -R[number]
right justifies the values assigned to each name by adding leading blanks or by truncating the start of the value as necessary. If the
-Loption is currently turned on, this option turns it off. -Z[number]
right justifies values assigned to each name. If the first non-blank character of value is a digit, leading zeroes are used. See also the
-L, -R, and -Zoptions do not work with integer variables.
contains a semicolon-separated list of directories to search for function definitions when an undefined function is executed.
Additionally, if this variable is defined and a PATH search fails to locate a command named cmdname, the directories specified in this variable are searched directory by directory for a script named cmdname.ksh or if that is not found, a script named cmdname. If such a script is found, it is executed in the current shell environment. Once that script has executed, the function cmdname, whose definition should have been included in the executed script, is now executed. If the function cmdname is still undefined, an error results.
Determines whether or environment variables that are considered to contain path names are displayed in Windows or UNIX format. When this variable is set to UNIX (this value is case-insensitive), such an enivronment variable is displayed in UNIX format; otherwise, it is displayed in Windows format. See the Environment Variables and Paths section of the EUCM reference page for more information.
When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use. For more information, see the EUCM reference page.
Possible exit status values are:
An error occurred. The return value may be the number of invalid names specified on the command line.
- Base number not in [2,36]
You used the
-ioption to specify a base for an integer, but the base was not in the range 2 through 36. All bases must be in this range.
- name: Not a function
The given name is not defined as a function.
Windows 2000. Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.
The declare, local, and typeset commands are built into the MKS KornShell.
MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
MKS Toolkit 9.5 Documentation Build 3.