From: "Teubel György" <tgyurci@gmail.com>
To: zsh-workers@zsh.org
Subject: [PATCH] Use == in expressions instead of the deprecated =
Date: Mon, 5 Sep 2016 23:27:54 +0200 [thread overview]
Message-ID: <20160905212754.24998-1-tgyurci@gmail.com> (raw)
---
Doc/Zsh/compsys.yo | 2 +-
Doc/Zsh/cond.yo | 2 +-
Doc/Zsh/contrib.yo | 2 +-
Doc/Zsh/expn.yo | 18 +++++++++---------
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 8c7ef0f..060a5c5 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2532,7 +2532,7 @@ current prefix is empty, is a single `tt(.)', or consists only of a path
beginning with `tt(../)'. Otherwise the value is `false'.
example(zstyle -e ':completion:*' special-dirs \
- '[[ $PREFIX = LPAR()../RPAR()#LPAR()|.|..RPAR() ]] && reply=LPAR()..RPAR()')
+ '[[ $PREFIX == LPAR()../RPAR()#LPAR()|.|..RPAR() ]] && reply=LPAR()..RPAR()')
)
kindex(squeeze-slashes, completion style)
item(tt(squeeze-slashes))(
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index 3d369fb..e87c1e6 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -248,7 +248,7 @@ tt($LPAR()LPAR())var(...)tt(RPAR()RPAR()).
For example, the following:
-example([[ ( -f foo || -f bar ) && $report = y* ]] && print File exists.)
+example([[ ( -f foo || -f bar ) && $report == y* ]] && print File exists.)
tests if either file tt(foo) or file tt(bar) exists, and if so, if the
value of the parameter tt(report) begins with `tt(y)'; if the complete
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 63df292..cf3a398 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -540,7 +540,7 @@ at run time:
example(zstyle -e ':chpwd:*' recent-dirs-file pick-recent-dirs-file
pick-recent-dirs-file+LPAR()RPAR() {
- if [[ $PWD = ~/text/writing+LPAR()|/*RPAR() ]]; then
+ if [[ $PWD == ~/text/writing+LPAR()|/*RPAR() ]]; then
reply=(~/.chpwd-recent-dirs-writing)
else
reply=(+)
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index ecb1877..40932fe 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -967,12 +967,12 @@ 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} ]])
+[[ $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} ]])
+[[ $str == ${~pattern} ]])
is always true for any possible value of tt($str).
)
@@ -1228,7 +1228,7 @@ that follow tt(~) within the same set of parentheses. Compare with tt(~)
outside parentheses, which forces the entire substituted string to
be treated as a pattern. Hence, for example,
-example([[ "?" = ${(~j.|.)array} ]])
+example([[ "?" == ${(~j.|.)array} ]])
treats `tt(|)' as a pattern and succeeds if and only if tt($array)
contains the string `tt(?)' as an element. The tt(~) may be
@@ -1829,20 +1829,20 @@ example(zsh_directory_name+LPAR()RPAR() {
emulate -L zsh
setopt extendedglob
local -a match mbegin mend
- if [[ $1 = d ]]; then
+ if [[ $1 == d ]]; then
# turn the directory into a name
- if [[ $2 = (#b)(/home/pws/perforce/)([^/]##)* ]]; then
+ if [[ $2 == (#b)(/home/pws/perforce/)([^/]##)* ]]; then
typeset -ga reply
reply=(p:$match[2] $(( ${#match[1]} + ${#match[2]} )) )
else
return 1
fi
- elif [[ $1 = n ]]; then
+ elif [[ $1 == n ]]; then
# turn the name into a directory
[[ $2 != (#b)p:(?*) ]] && return 1
typeset -ga reply
reply=(/home/pws/perforce/$match[1])
- elif [[ $1 = c ]]; then
+ elif [[ $1 == c ]]; then
# complete names
local expl
local -a dirs
@@ -2206,7 +2206,7 @@ parentheses can be referenced.
For example,
example(foo="a string with a message"
-if [[ $foo = (a|an)' '(#b)(*)' '* ]]; then
+if [[ $foo == (a|an)' '(#b)(*)' '* ]]; then
print ${foo[$mbegin[1],$mend[1]]}
fi)
@@ -2224,7 +2224,7 @@ The numbering of backreferences strictly follows the order of the opening
parentheses from left to right in the pattern string, although sets of
parentheses may be nested. There are special rules for parentheses followed
by `tt(#)' or `tt(##)'. Only the last match of the parenthesis is
-remembered: for example, in `tt([[ abab = (#b)([ab])# ]])', only the final
+remembered: for example, in `tt([[ abab == (#b)([ab])# ]])', only the final
`tt(b)' is stored in tt(match[1]). Thus extra parentheses may be necessary
to match the complete segment: for example, use
`tt(X+LPAR()(ab|cd)#+RPAR()Y)' to match
--
2.9.3
next reply other threads:[~2016-09-07 18:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 21:27 Teubel György [this message]
2016-09-08 8:35 ` Peter Stephenson
2016-09-08 11:16 ` Peter Stephenson
2016-09-08 14:31 ` Stephane Chazelas
2016-09-08 15:06 ` Stephane Chazelas
2016-09-08 15:14 ` Peter Stephenson
2016-09-08 16:39 ` Mikael Magnusson
2016-09-08 18:47 ` Stephane Chazelas
2016-09-09 12:03 ` Vincent Lefevre
[not found] ` <CGME20160912143133eucas1p11a4e6916dd70b3ceaa163bf3bddfb007@eucas1p1.samsung.com>
2016-09-12 14:31 ` Peter Stephenson
2016-09-09 8:52 ` Stephane Chazelas
2016-09-09 9:31 ` Peter Stephenson
2016-09-09 16:00 ` Stephane Chazelas
2016-09-14 22:01 ` PATCH: [[ -v varname ]] Oliver Kiddle
2016-09-15 10:55 ` Vincent Lefevre
2016-09-16 0:36 ` Bart Schaefer
2016-09-15 11:08 ` Stephane Chazelas
2016-09-15 11:22 ` wrong "export -p" output for exported but not set variables (Was: PATCH: [[ -v varname ]]) Stephane Chazelas
2016-09-09 17:01 ` [PATCH] Use == in expressions instead of the deprecated = Christian Neukirchen
2016-09-09 18:54 ` Stephane Chazelas
2016-09-09 13:05 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160905212754.24998-1-tgyurci@gmail.com \
--to=tgyurci@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).