Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Shells: User's Guide: HP 9000 Computers > Chapter 23 Advanced Concepts and Commands

The typeset Command (for Korn Shell only)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

This command creates a shell variable, assigns it a value, and specifies certain attributes for the variable, such as integer and read-only.

The syntax is:

set typeset [-HLRZfilprtux[n] [name [=value]]...]

where name is the shell variable to be created, value is to be assigned according to the options set.

The following example makes year read-only.

$ typeset -r year=2000
$ echo $year
$ year=2001
ksh: year: is readonly

The following list of attributes may be specified by the designated option or flag:

-F

This flag provides UNIX to host name file mapping on non-UNIX machines.

-L

Left justify and remove leading blanks from value. If n is nonzero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. When the parameter receives a value, it is filled on the right with blanks or truncated to fit into the field. Leading zeros are removed if the -Z flag is also set. This turns the -R flag off.

-R

Right justify and fill with leading blanks. If n is nonzero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. The field is left filled with blanks or truncated from the end if the parameter is reassigned. This turns the L flag off.

-Z

Right justify and fill with leading zeros if the first nonblank character is a digit and the -L flag has not been set. If n is nonzero it defines the width of the field, otherwise it is determined by the width of the value of first assignment.

-e

Tag the parameter as having an error. This tag is currently unused by the shell and can be set or cleared by the user.

-f

The names refer to function names rather than parameter names. No assignments can be made and the only other valid flag is -x.

-i

The name is an integer. This makes arithmetic faster. If n is nonzero it defines the output arithmetic base, otherwise the first assignment determines the output base.

-l

All uppercase characters converted to lowercase. The uppercase flag, -u is turned off.

-p

The output of this command, if any, is written onto the two-way pipe.

-r

The given names are marked read-only and these names cannot be changed by subsequent assignment.

-t

Tags the name. Tags are user definable and have no special meaning to the shell.

-u

All lowercase characters are converted to uppercase characters. This turns the lowercase flag, -l, off.

-x

The given names are marked for automatic export to the environment of subsequently executed commands.

Using + rather than - causes these flags to be turned off. If no name arguments are given but flags are specified, a list of names (and optionally the values) of the parameters which have these flags set is printed. (Using + rather than - keeps the values to be printed.) If no names and options are given, the names and attributes of all parameters are printed.

The following example covers some of the attributes set above:

$ typeset -i arg1=3 arg2=22
$ echo $arg1 $arg2
3 22
$ typeset
...
export PATH
readonly year
integer arg2
integer arg1
...
$ typeset -u up=letters
$ echo $up
LETTERS
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-1991 Hewlett-Packard Development Company, L.P.