about summary refs log tree commit diff
path: root/Doc/Zsh/expn.yo
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-05-10 19:19:34 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-05-10 19:19:34 +0100
commit6269db883ad6989a578bac299deab9c4285bb1df (patch)
tree29639c2221b8b15fc2e9d36ee9f5e03b529dc038 /Doc/Zsh/expn.yo
parentbb2362e2c049602b79116aa9570a72dd89711349 (diff)
downloadzsh-6269db883ad6989a578bac299deab9c4285bb1df.tar.gz
zsh-6269db883ad6989a578bac299deab9c4285bb1df.tar.xz
zsh-6269db883ad6989a578bac299deab9c4285bb1df.zip
35067: Add (b) parameter flag for pattern char backslashing.
Doc tweak from Daniel in 35071.

Includes test.
Diffstat (limited to 'Doc/Zsh/expn.yo')
-rw-r--r--Doc/Zsh/expn.yo19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 85191edeb..8e5ab4bfd 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1014,6 +1014,25 @@ form of single quoting is used that only quotes the string if needed to
 protect special characters.  Typically this form gives the most readable
 output.
 )
+item(tt(b))(
+Quote with backslashes only characters that are special to pattern
+matching. This is useful when the contents of the variable are to be
+tested using tt(GLOB_SUBST), including the tt(${~)var(...)tt(}) switch.
+
+Quoting using one of the tt(q) family of flags does not work
+for this purpose since quotes are not stripped from non-pattern
+characters by tt(GLOB_SUBST).  In other words,
+
+example(pattern=${(q)str}
+[[ $str = ${~pattern} ]])
+
+works if tt($str) is tt('a*b') but not if it is tt('a b'), whereas
+
+example(pattern=${(b)str}
+[[ $str = ${~pattern} ]])
+
+is always true for any possible value of tt($str).
+)
 item(tt(Q))(
 Remove one level of quotes from the resulting words.
 )