diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2007-05-30 03:08:22 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2007-05-30 03:08:22 +0000 |
commit | eb3252d67b6e5e34db76cd09f94427482480b2a1 (patch) | |
tree | a3ccaba05f044e45fd5207185af5b201f66f00db /Doc/Zsh | |
parent | 5af264a64282689453f79ce943604d20110e4ffd (diff) | |
download | zsh-eb3252d67b6e5e34db76cd09f94427482480b2a1.tar.gz zsh-eb3252d67b6e5e34db76cd09f94427482480b2a1.tar.xz zsh-eb3252d67b6e5e34db76cd09f94427482480b2a1.zip |
users/11366 (belated commit): update documentation for ${var:-word} and
related expressions.
Diffstat (limited to 'Doc/Zsh')
-rw-r--r-- | Doc/Zsh/expn.yo | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index df95ccef2..b194febb0 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -486,39 +486,39 @@ item(tt(${PLUS())var(name)tt(}))( If var(name) is the name of a set parameter `tt(1)' is substituted, otherwise `tt(0)' is substituted. ) +xitem(tt(${)var(name)tt(-)var(word)tt(})) item(tt(${)var(name)tt(:-)var(word)tt(}))( -If var(name) is set and is non-null then substitute its -value; otherwise substitute var(word). If var(name) is -missing, substitute var(word). -Note that you can use standard shell quoting in the var(word) value to -selectively override the splitting done by the tt(SH_WORD_SPLIT) option -and the tt(=) flag, but not the tt(s:)var(string)tt(:) flag. +If var(name) is set, or in the second form is non-null, then substitute +its value; otherwise substitute var(word). In the second form var(name) +may be omitted, in which case var(word) is always substituted. ) +xitem(tt(${)var(name)tt(PLUS())var(word)tt(})) +item(tt(${)var(name)tt(:PLUS())var(word)tt(}))( +If var(name) is set, or in the second form is non-null, then substitute +var(word); otherwise substitute nothing. +) +xitem(tt(${)var(name)tt(=)var(word)tt(})) xitem(tt(${)var(name)tt(:=)var(word)tt(})) item(tt(${)var(name)tt(::=)var(word)tt(}))( -In the first form, if var(name) is unset or is null then -set it to var(word); in the second form, unconditionally -set var(name) to var(word). In both forms, the value of -the parameter is then substituted. +In the first form, if var(name) is unset then set it to var(word); in the +second form, if var(name) is unset or null then set it to var(word); and +in the third form, unconditionally set var(name) to var(word). In all +forms, the value of the parameter is then substituted. ) +xitem(tt(${)var(name)tt(?)var(word)tt(})) item(tt(${)var(name)tt(:?)var(word)tt(}))( -If var(name) is set and is non-null then substitute -its value; otherwise, print var(word) and exit from the shell. -Interactive shells instead return to the prompt. -If var(word) is omitted, then a standard message is printed. -) -item(tt(${)var(name)tt(:PLUS())var(word)tt(}))( -If var(name) is set and is non-null then substitute -var(word); otherwise substitute nothing. -Note that you can use standard shell quoting in the var(word) value to -selectively override the splitting done by the tt(SH_WORD_SPLIT) option -and the tt(=) flag, but not the tt(s:)var(string)tt(:) flag. +In the first form, if var(name) is set, or in the second form if var(name) +is both set and non-null, then substitute its value; otherwise, print +var(word) and exit from the shell. Interactive shells instead return to +the prompt. If var(word) is omitted, then a standard message is printed. ) enditem() -If the colon is omitted from one of the above expressions -containing a colon, then the shell only checks whether -var(name) is set, not whether its value is null. +In any of the above expressions that test a variable and substitute an +alternate var(word), note that you can use standard shell quoting in the +var(word) value to selectively override the splitting done by the +tt(SH_WORD_SPLIT) option and the tt(=) flag, but not splitting by the +tt(s:)var(string)tt(:) flag. In the following expressions, when var(name) is an array and the substitution is not quoted, or if the `tt((@))' flag or the |