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

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



Stephane Chazelas <stephane.chazelas@xxxxxxxxx> writes:

> 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 [[...]]. 

My ksh93 (ksh-2012.08.01) man page says:

   Conditional Expressions.
       A conditional expression is used with the [[ compound command to test
       attributes of files and to compare strings.
   ...
       string == pattern
              True, if string matches pattern.  Any part of pattern can be
              quoted to cause it to be matched as a string.  With a successful
              match to a pattern, the .sh.match array variable will contain
              the match and sub-pattern matches.
       string = pattern
              Same as == above, but is obsolete.

-- 
Christian Neukirchen  <chneukirchen@xxxxxxxxx>  http://chneukirchen.org



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