1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-13 03:30:54 +02:00

Further doucmentation improvements after comments from Bart and Oliver

This commit is contained in:
Peter Stephenson 2015-06-23 10:00:04 +01:00
parent 2a1065a455
commit a2229ce10c
2 changed files with 32 additions and 23 deletions

View file

@ -1729,7 +1729,7 @@ xitem(tt(typeset )[ {tt(PLUS())|tt(-)}tt(AHUaghlmprtux) ] \
[ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ]) [ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ])
xitem(SPACES()[ tt(+) | var(name)[tt(=)var(value)] ... ]) xitem(SPACES()[ tt(+) | var(name)[tt(=)var(value)] ... ])
xitem(tt(typeset )tt(-T) [ {tt(PLUS())|tt(-)}tt(Uglprux) ] [ {tt(PLUS())|tt(-)}tt(LRZ) [ var(n) ] ]) xitem(tt(typeset )tt(-T) [ {tt(PLUS())|tt(-)}tt(Uglprux) ] [ {tt(PLUS())|tt(-)}tt(LRZ) [ var(n) ] ])
xitem(SPACES()[ tt(+) | var(SCALAR)[tt(=)var(value)] var(array) [ var(sep) ] ]) xitem(SPACES()[ tt(+) | var(SCALAR)[tt(=)var(value)] var(array)[tt(=)LPAR()var(value)RPAR()] [ var(sep) ] ])
item(tt(typeset) tt(-f) [ {tt(PLUS())|tt(-)}tt(TUkmtuz) ] [ tt(+) | var(name) ... ])( item(tt(typeset) tt(-f) [ {tt(PLUS())|tt(-)}tt(TUkmtuz) ] [ tt(+) | var(name) ... ])(
Set or display attributes and values for shell parameters. Set or display attributes and values for shell parameters.
@ -1746,32 +1746,36 @@ For each var(name)tt(=)var(value) assignment, the parameter
var(name) is set to var(value). All forms of the command var(name) is set to var(value). All forms of the command
handle scalar assignment. handle scalar assignment.
If the reserved word tt(declare), tt(export), tt(float), tt(integer), If any of the reserved words tt(declare), tt(export), tt(float),
tt(local), tt(readonly) or tt(typeset) is matched when the line is tt(integer), tt(local), tt(readonly) or tt(typeset) is matched when the
parsed (N.B. not when it is executed), and the reserved word has not line is parsed (N.B. not when it is executed) the shell will try to parse
been disabled with tt(disable -r), the shell will try to parse arguments arguments as assignments, except that the `tt(+=)' syntax and the
as assignments, except that the `tt(+=)' syntax and the tt(GLOB_ASSIGN) tt(GLOB_ASSIGN) option are not supported. This has two major differences
option are not supported. This has two major differences from normal from normal command line argument parsing: array assignment is possible,
command line argument parsing: array assignment is possible, and scalar and scalar values after tt(=) are not split further into words even if
values after tt(=) are not split further into words even if expanded expanded (regardless of the setting of the tt(KSH_TYPESET) option; this
(regardless of the setting of the tt(KSH_TYPESET) option; this option option is obsolete). Here is an example:
is obsolete). Here is an example:
example(# Reserved word parsing example(# Reserved word parsing
typeset svar=$(echo one word) avar=(several words)) typeset svar=$(echo one word) avar=(several words))
The above creates a scalar parameter tt(svar) with the value `tt(one The above creates a scalar parameter tt(svar) and an array
word)' and an array parameter tt(avar) with a value containing two parameter tt(var) as if the assignments had been
entries, `tt(several)' and `tt(words)'. On the other hand:
example(svar="one word"
avar=(several words))
On the other hand:
example(# Normal builtin interface example(# Normal builtin interface
cmd=typeset builtin typeset svar=$(echo two words))
$cmd svar=$(echo two words))
The above creates a scalar tt(svar) contain the value tt(two) and The tt(builtin) keyword causes the above to use the standard builtin
another scalar parameter tt(words) with no value. An array value in interface to tt(typeset) in which argument parsing is perfomed in the same
this case would either cause an error or be treated as an obscure set of way as for other commands. This example creates a scalar tt(svar)
glob qualifiers. containing the value tt(two) and another scalar parameter tt(words) with
no value. An array value in this case would either cause an error or be
treated as an obscure set of glob qualifiers.
Arbitrary arguments are allowed if they take the form of assignments Arbitrary arguments are allowed if they take the form of assignments
after command line expansion; however, these only perform scalar after command line expansion; however, these only perform scalar
@ -1794,6 +1798,11 @@ a set of three normal command line arguments to tt(typeset) after
expansion. Hence it is not possible to assign to multiple arrays by expansion. Hence it is not possible to assign to multiple arrays by
this means. this means.
Note that each interface to any of the commands my be disabled
separately. For example, `tt(disable -r typeset)' disables the reserved
word interface to tt(typeset), exposing the builtin interface, while
`tt(disable typeset)' disables the builtin.
If the shell option tt(TYPESET_SILENT) is not set, for each remaining If the shell option tt(TYPESET_SILENT) is not set, for each remaining
var(name) that refers to a parameter that is already set, the name and var(name) that refers to a parameter that is already set, the name and
value of the parameter are printed in the form of an assignment. value of the parameter are printed in the form of an assignment.
@ -1870,7 +1879,7 @@ the current state, readonly specials (whose values cannot be
changed) are not shown and assignments to arrays are shown before changed) are not shown and assignments to arrays are shown before
the tt(typeset) rendering the array readonly. the tt(typeset) rendering the array readonly.
) )
item(tt(-T) [ var(scalar)[tt(=)var(value)] var(array)[tt(=)LPAR()var(value...)RPAR()] [ var(sep) ] ])( item(tt(-T) [ var(scalar)[tt(=)var(value)] var(array)[tt(=)LPAR()var(value)...RPAR()] [ var(sep) ] ])(
This flag has a different meaning when used with tt(-f); see below. This flag has a different meaning when used with tt(-f); see below.
Otherwise the tt(-T) option requires zero, two, or three arguments to be Otherwise the tt(-T) option requires zero, two, or three arguments to be
present. With no arguments, the list of parameters created in this present. With no arguments, the list of parameters created in this

4
README
View file

@ -44,8 +44,8 @@ interface, exposing the builtin interface:
disable -r declare export float integer local readonly typeset disable -r declare export float integer local readonly typeset
This is also necessary in the unusual eventuality that the builtins are This is also necessary in the unusual eventuality that the builtins are
to be replaced by shell functions, since reserved words take precedence to be overridden by shell functions, since reserved words take
over functions. precedence over functions.
Incompatibilites between 5.0.7 and 5.0.8 Incompatibilites between 5.0.7 and 5.0.8
---------------------------------------- ----------------------------------------