Unix command.
`typeset` - shell built-in functions to set/get attributes and values for shell variables and functions
typeset sets attributes and values for shell variables and functions. When typeset is invoked inside a function, a new instance of the variables name is created. The variables value and type are restored when the function completes. The following list of attributes may be specified:
-H 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 non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. When the variable is assigned to, it is filled on the right with blanks or truncated, if necessary, to fit into the field. Leading zeros are removed if the -Z flag is also set. The -R flag is turned off.
-R Right justify and fill with leading blanks. If n is non-zero 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 variable is reassigned. The -L flag is turned off.
-Z Right justify and fill with leading zeros if the first non-blank character is a digit and the -L flag has not been set. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment.
-f The names refer to function names rather than variable names. No assignments can be made and the only other valid flags are -t, -u and -x. The flag -t turns on execution tracing for this function. The flag -u causes this function to be marked undefined. The FPATH variable will be searched to find the function definition when the function is referenced. The flag -x allows the function definition to remain in effect across shell procedures invoked by name.
-i Parameter is an integer. This makes arithmetic fas- ter. If n is non-zero it defines the output arithmetic base; otherwise, the first assignment determines the output base.
-l All upper-case characters are converted to lower-case. The upper-case flag, -u is turned off.
-r The given names are marked readonly and these names cannot be changed by subsequent assignment.
-t Tags the variables. Tags are user definable and have no special meaning to the shell.
-u All lower-case characters are converted to upper-case characters. The lower-case flag, -l is turned off.
-x The given names are marked for automatic export to the environment of subsequently-executed commands.
EXAMPLE:
$ a="907b67"
$ typeset -R3 a
$ echo $a
b67
Thursday, August 16, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment