diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2013-01-03 19:01:52 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2013-01-03 19:01:52 +0000 |
commit | 91197f49936a453ef48b43cc443c111a651a77bd (patch) | |
tree | e7921a861db1ba64c2dbc2a97b0402b26d517e50 | |
parent | 1873fd0684a4cce2b6eeb21b9d53490e91fb809c (diff) | |
download | zsh-91197f49936a453ef48b43cc443c111a651a77bd.tar.gz zsh-91197f49936a453ef48b43cc443c111a651a77bd.tar.xz zsh-91197f49936a453ef48b43cc443c111a651a77bd.zip |
users/17524: misc. parameter flag clarifications
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Doc/Zsh/expn.yo | 31 |
2 files changed, 24 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog index b50480a94..f9026eec5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-01-03 Bart Schaefer <schaefer@zsh.org> + + * users/17524: Doc/Zsh/expn.yo: misc. parameter flag clarifications. + 2013-01-03 Peter Stephenson <pws@csr.com> * unposted: Config/version.mk: update version to 5.0.2-dev-0 @@ -417,5 +421,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5779 $ +* $Revision: 1.5780 $ ***************************************************** diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index da68b4ff7..0f5494e2a 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -748,6 +748,8 @@ If var(spec) is one of the above substitutions, substitute the length in characters of the result instead of the result itself. If var(spec) is an array expression, substitute the number of elements of the result. +This has the side-effect that joining is skipped even in quoted +forms, which may affect other sub-expressions in var(spec). Note that `tt(^)', `tt(=)', and `tt(~)', below, must appear to the left of `tt(#)' when these forms are combined. ) @@ -870,11 +872,12 @@ item(tt(A))( Create an array parameter with `tt(${)...tt(=)...tt(})', `tt(${)...tt(:=)...tt(})' or `tt(${)...tt(::=)...tt(})'. If this flag is repeated (as in `tt(AA)'), create an associative -array parameter. Assignment is made before sorting or padding. -The var(name) part may be a subscripted range for ordinary -arrays; the var(word) part em(must) be converted to an array, for -example by using `tt(${(AA)=)var(name)tt(=)...tt(})' to activate -field splitting, when creating an associative array. +array parameter. Assignment is made before sorting or padding; +if field splitting is active, the var(word) part is split before +assignment. The var(name) part may be a subscripted range for +ordinary arrays; the var(word) part em(must) be converted to +an array, for example by using `tt(${(AA)=)var(name)tt(=)...tt(})' +to activate field splitting, when creating an associative array. ) item(tt(a))( Sort in array index order; when combined with `tt(O)' sort in reverse @@ -884,7 +887,9 @@ order. ) item(tt(c))( With tt(${#)var(name)tt(}), count the total number of characters in an array, -as if the elements were concatenated with spaces between them. +as if the elements were concatenated with spaces between them. This is not +a true join of the array, so other expressions used with this flag may have +an effect on the elements of the array before it is counted. ) item(tt(C))( Capitalize the resulting words. `Words' in this case refers to sequences @@ -1308,7 +1313,8 @@ subscripts apply to the scalar or array value yielded by the previous subscript. Thus if tt(var) is an array, tt(${var[1][2]}) is the second character of the first word, but tt(${var[2,4][2]}) is the entire third word (the second word of the range of words two through four of the -original array). Any number of subscripts may appear. +original array). Any number of subscripts may appear. Flags such as +tt((k)) and tt((v)) which alter the result of subscripting are applied. ) item(tt(4.) em(Parameter name replacement))( The effect of any tt((P)) flag, which treats the value so far as a @@ -1316,11 +1322,12 @@ parameter name and replaces it with the corresponding value, is applied. ) item(tt(5.) em(Double-quoted joining))( If the value after this process is an array, and the substitution -appears in double quotes, and no tt((@)) flag is present at the current -level, the words of the value are joined with the first character of the -parameter tt($IFS), by default a space, between each word (single word -arrays are not modified). If the tt((j)) flag is present, that is used for -joining instead of tt($IFS). +appears in double quotes, and neither an tt((@)) flag nor a tt(#) +length operator is present at the current level, then words of the +value are joined with the first character of the parameter tt($IFS), +by default a space, between each word (single word arrays are not +modified). If the tt((j)) flag is present, that is used for joining +instead of tt($IFS). ) item(tt(6.) em(Nested subscripting))( Any remaining subscripts (i.e. of a nested substitution) are evaluated at |