1typeset [ {+|-}AEFHUafghklprtuxmz ] [ -LRZi [ n ]] [ name[=value] ... ] 2typeset -T [ {+|-}Urux ] [ -LRZ [ n ]] SCALAR[=value] array [ sep ] 3 Set or display attributes and values for shell parameters. 4 5 A parameter is created for each name that does not already refer 6 to one. When inside a function, a new parameter is created for 7 every name (even those that already exist), and is unset again 8 when the function completes. See `Local Parameters' in zsh- 9 param(1). The same rules apply to special shell parameters, 10 which retain their special attributes when made local. 11 12 For each name=value assignment, the parameter name is set to 13 value. Note that arrays currently cannot be assigned in typeset 14 expressions, only scalars and integers. Unless the option 15 KSH TYPESET is set, normal expansion rules apply to assignment 16 - 17 arguments, so value may be split into separate words; if the 18 option is set, assignments which can be recognised when expan- 19 sion is performed are treated as single words. For example the 20 command typeset vbl=$(echo one two) is treated as having one 21 argument if KSH TYPESET is set, but otherwise is treated as hav- 22 - 23 ing the two arguments vbl=one and two. 24 25 If the shell option TYPESET SILENT is not set, for each remain- 26 - 27 ing name that refers to a parameter that is set, the name and 28 value of the parameter are printed in the form of an assignment. 29 Nothing is printed for newly-created parameters, or when any 30 attribute flags listed below are given along with the name. 31 Using `+' instead of minus to introduce an attribute turns it 32 off. 33 34 If the -p option is given, parameters and values are printed in 35 the form of a typeset command and an assignment (which will be 36 printed separately for arrays and associative arrays), regard- 37 less of other flags and options. Note that the -h flag on 38 parameters is respected; no value will be shown for these param- 39 eters. 40 41 If the -T option is given, two or three arguments must be 42 present (an exception is that zero arguments are allowed to show 43 the list of parameters created in this fashion). The first two 44 are the name of a scalar and an array parameter (in that order) 45 that will be tied together in the manner of $PATH and $path. 46 The optional third argument is a single-character separator 47 which will be used to join the elements of the array to form the 48 scalar; if absent, a colon is used, as with $PATH. Only the 49 first character of the separator is significant; any remaining 50 characters are ignored. Only the scalar parameter may be 51 assigned an initial value. Both the scalar and the array may 52 otherwise be manipulated as normal. If one is unset, the other 53 will automatically be unset too. There is no way of untying the 54 variables without unsetting them, or converting the type of one 55 of them with another typeset command; +T does not work, assign- 56 ing an array to SCALAR is an error, and assigning a scalar to 57 array sets it to be a single-element array. Note that both 58 `typeset -xT ...' and `export -T ...' work, but only the scalar 59 will be marked for export. Setting the value using the scalar 60 version causes a split on all separators (which cannot be 61 quoted). It is possible to use the same two tied variables with 62 a different separator character in which case the variables 63 remain joined as before but the separator is changed. This flag 64 has a different meaning when used with -f; see below. 65 66 The -g (global) flag is treated specially: it means that any 67 resulting parameter will not be restricted to local scope. Note 68 that this does not necessarily mean that the parameter will be 69 global, as the flag will apply to any existing parameter (even 70 if unset) from an enclosing function. This flag does not affect 71 the parameter after creation, hence it has no effect when list- 72 ing existing parameters, nor does the flag +g have any effect 73 except in combination with -m (see below). 74 75 If no name is present, the names and values of all parameters 76 are printed. In this case the attribute flags restrict the dis- 77 play to only those parameters that have the specified 78 attributes, and using `+' rather than `-' to introduce the flag 79 suppresses printing of the values of parameters when there is no 80 parameter name. Also, if the last option is the word `+', then 81 names are printed but values are not. 82 83 If the -m flag is given the name arguments are taken as patterns 84 (which should be quoted). With no attribute flags, all parame- 85 ters (or functions with the -f flag) with matching names are 86 printed (the shell option TYPESET SILENT is not used in this 87 - 88 case). Note that -m is ignored if no patterns are given. If 89 the +g flag is combined with -m, a new local parameter is cre- 90 ated for every matching parameter that is not already local. 91 Otherwise -m applies all other flags or assignments to the 92 existing parameters. Except when assignments are made with 93 name=value, using +m forces the matching parameters to be 94 printed, even inside a function. 95 96 If no attribute flags are given and either no -m flag is present 97 or the +m form was used, each parameter name printed is preceded 98 by a list of the attributes of that parameter (array, associa- 99 tion, exported, integer, readonly). If +m is used with 100 attribute flags, and all those flags are introduced with +, the 101 matching parameter names are printed but their values are not. 102 103 Attribute flags that transform the final value (-L, -R, -Z, -l, 104 u) are only applied to the expanded value at the point of a 105 parameter expansion expression using `$'. They are not applied 106 when a parameter is retrieved internally by the shell for any 107 purpose. 108 109 The following attribute flags may be specified: 110 111 -A The names refer to associative array parameters; see 112 `Array Parameters' in zshparam(1). 113 114 -L Left justify and remove leading blanks from value. If n 115 is nonzero, it defines the width of the field. If n is 116 zero, the width is determined by the width of the value 117 of the first assignment. In the case of numeric parame- 118 ters, the length of the complete value assigned to the 119 parameter is used to determine the width, not the value 120 that would be output. 121 122 The width is the count of characters, which may be multi- 123 byte characters if the MULTIBYTE option is in effect. 124 Note that the screen width of the character is not taken 125 into account; if this is required, use padding with 126 parameter expansion flags ${(ml...)...} as described in 127 `Parameter Expansion Flags' in zshexpn(1). 128 129 When the parameter is expanded, it is filled on the right 130 with blanks or truncated if necessary to fit the field. 131 Note truncation can lead to unexpected results with 132 numeric parameters. Leading zeros are removed if the -Z 133 flag is also set. 134 135 -R Similar to -L, except that right justification is used; 136 when the parameter is expanded, the field is left filled 137 with blanks or truncated from the end. May not be com- 138 bined with the -Z flag. 139 140 -U For arrays (but not for associative arrays), keep only 141 the first occurrence of each duplicated value. This may 142 also be set for colon-separated special parameters like 143 PATH or FIGNORE, etc. This flag has a different meaning 144 when used with -f; see below. 145 146 -Z Specially handled if set along with the -L flag. Other- 147 wise, similar to -R, except that leading zeros are used 148 for padding instead of blanks if the first non-blank 149 character is a digit. Numeric parameters are specially 150 handled: they are always eligible for padding with 151 zeroes, and the zeroes are inserted at an appropriate 152 place in the output. 153 154 -a The names refer to array parameters. An array parameter 155 may be created this way, but it may not be assigned to in 156 the typeset statement. When displaying, both normal and 157 associative arrays are shown. 158 159 -f The names refer to functions rather than parameters. No 160 assignments can be made, and the only other valid flags 161 are -t, -T, -k, -u, -U and -z. The flag -t turns on exe- 162 cution tracing for this function; the flag -T does the 163 same, but turns off tracing on any function called from 164 the present one, unless that function also has the -t or 165 -T flag. The -u and -U flags cause the function to be 166 marked for autoloading; -U also causes alias expansion to 167 be suppressed when the function is loaded. The fpath 168 parameter will be searched to find the function defini- 169 tion when the function is first referenced; see the sec- 170 tion `Functions'. The -k and -z flags make the function 171 be loaded using ksh-style or zsh-style autoloading 172 respectively. If neither is given, the setting of the 173 KSH AUTOLOAD option determines how the function is 174 - 175 loaded. 176 177 -h Hide: only useful for special parameters (those marked 178 `<S>' in the table in zshparam(1)), and for local parame- 179 ters with the same name as a special parameter, though 180 harmless for others. A special parameter with this 181 attribute will not retain its special effect when made 182 local. Thus after `typeset -h PATH', a function contain- 183 ing `typeset PATH' will create an ordinary local parame- 184 ter without the usual behaviour of PATH. Alternatively, 185 the local parameter may itself be given this attribute; 186 hence inside a function `typeset -h PATH' creates an 187 ordinary local parameter and the special PATH parameter 188 is not altered in any way. It is also possible to create 189 a local parameter using `typeset +h special', where the 190 local copy of special will retain its special properties 191 regardless of having the -h attribute. Global special 192 parameters loaded from shell modules (currently those in 193 zsh/mapfile and zsh/parameter) are automatically given 194 the -h attribute to avoid name clashes. 195 196 -H Hide value: specifies that typeset will not display the 197 value of the parameter when listing parameters; the dis- 198 play for such parameters is always as if the `+' flag had 199 been given. Use of the parameter is in other respects 200 normal, and the option does not apply if the parameter is 201 specified by name, or by pattern with the -m option. 202 This is on by default for the parameters in the 203 zsh/parameter and zsh/mapfile modules. Note, however, 204 that unlike the -h flag this is also useful for non-spe- 205 cial parameters. 206 207 -i Use an internal integer representation. If n is nonzero 208 it defines the output arithmetic base, otherwise it is 209 determined by the first assignment. Bases from 2 to 36 210 inclusive are allowed. 211 212 -E Use an internal double-precision floating point represen- 213 tation. On output the variable will be converted to sci- 214 entific notation. If n is nonzero it defines the number 215 of significant figures to display; the default is ten. 216 217 -F Use an internal double-precision floating point represen- 218 tation. On output the variable will be converted to 219 fixed-point decimal notation. If n is nonzero it defines 220 the number of digits to display after the decimal point; 221 the default is ten. 222 223 -l Convert the result to lower case whenever the parameter 224 is expanded. The value is not converted when assigned. 225 226 -r The given names are marked readonly. Note that if name 227 is a special parameter, the readonly attribute can be 228 turned on, but cannot then be turned off. 229 230 -t Tags the named parameters. Tags have no special meaning 231 to the shell. This flag has a different meaning when 232 used with -f; see above. 233 234 -u Convert the result to upper case whenever the parameter 235 is expanded. The value is not converted when assigned. 236 This flag has a different meaning when used with -f; see 237 above. 238 239 -x Mark for automatic export to the environment of subse- 240 quently executed commands. If the option GLOBAL EXPORT 241 - 242 is set, this implies the option -g, unless +g is also 243 explicitly given; in other words the parameter is not 244 made local to the enclosing function. This is for com- 245 patibility with previous versions of zsh. 246 247declare 248 Same as typeset. 249 250float [ {+|-}EFHghlprtux ] [ -LRZ [ n ]] [ name[=value] ... ] 251 Equivalent to typeset -E, except that options irrelevant to 252 floating point numbers are not permitted. 253 254integer [ {+|-}Hghilprtux ] [ -LRZ [ n ]] [ name[=value] ... ] 255 Equivalent to typeset -i, except that options irrelevant to 256 integers are not permitted. 257 258local [ {+|-}AEFHUahlprtux ] [ -LRZi [ n ]] [ name[=value] ] ... 259 Same as typeset, except that the options -g, and -f are not per- 260 mitted. In this case the -x option does not force the use of 261 -g, i.e. exported variables will be local to functions. 262 263readonly 264 Same as typeset -r. 265