UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: typeChapter 4
The Bourne Shell and Korn Shell
Next: Reference: ulimit
 

typeset

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

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.

Options

-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 will locate the function when it's first used). x exports the function. Note the aliases autoload and function.

-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 flush-left strings, n characters long (truncate or pad with blanks on the right as needed). Leading blanks are stripped; leading 0's 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.

-R[n]

Define variables as flush-right 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 0's. When used alone, it's similar to -R except that -Z pads numeric values with 0's and pads text values with blanks.

Examples

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, 5 characters wide.


Previous: Reference: typeUNIX in a Nutshell: System V EditionNext: Reference: ulimit
Reference: typeBook IndexReference: ulimit

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System