Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Use == in expressions instead of the deprecated =



On Thu, Sep 8, 2016 at 5:14 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Thu, 08 Sep 2016 15:31:28 +0100
> Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
>> 2016-09-08 12:16:28 +0100, Peter Stephenson:
>> [...]
>> > diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
>> > index 3d369fb..6fcf3bd 100644
>> > --- a/Doc/Zsh/cond.yo
>> > +++ b/Doc/Zsh/cond.yo
>> > @@ -103,8 +103,8 @@ true if var(file1) and var(file2) exist and refer to the same file.
>> >  xitem(var(string) tt(=) var(pattern))
>> >  item(var(string) tt(==) var(pattern))(
>> >  true if var(string) matches var(pattern).
>> > -The `tt(==)' form is the preferred one.  The `tt(=)' form is for
>> > -backward compatibility and should be considered obsolete.
>> > +The `tt(==)' form is the preferred one for clarity in new shell code
>> > +as it more closely resembles other languages.
>> [...]
>>
>> ksh93 also makes "==" obsolete in [[...]]. "==" is still not
>> POSIX (and likely not going to be soon as requests to add it
>> have been rejected (IIRC)) for the "test"/"[" utility (or expr).

POSIX doesn't have [[...]] so what it says isn't really relevant. [ a
== b ] doesn't work in zsh by default either, you have to use either [
a = b ] or [ a \== b ] and obviously the latter is pretty ridiculous.
:)

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author