From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7276 invoked by alias); 11 Sep 2016 02:30:37 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39270 Received: (qmail 20778 invoked from network); 11 Sep 2016 02:30:37 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f48.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.48):SA:0(0.0/5.0):. Processed in 0.624896 secs); 11 Sep 2016 02:30:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.48 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=FvoaDiQbpGkJvfebGmJDWE+rEXlqPSOXDoHNmE1/cRE=; b=tfGzNAY2vwhSyC8G+bStA5q+ZnBFWBafcYFkf0DaIzXkwlaqizZaVZF35UG6EpwsPB pHpT7QkeBaI64HoABCtqsBymJHyBPlm1C4LNLVO3IINgKbyrqAfuDNFXbrMbIHQ/LF5U B6j1qzJIF0i1L52x7q1SkPL2lQJ7VW2UaehcrN+zDq23iKlYqQka3EjY5dCA/q5j+EsS ElDxbnCQ9iXFwNdKQCHyFLF9OWuwGf/bJraD+R7PZ+qYYZAUQ5q5iWARr2LB77VLrdh/ h+Z+Np+LBU9tT6ZReWjgh5JjCOiKQjjltmdXh/Le/A5bkhRpArbPGhIpijcQ8RoHM3oh FB6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=FvoaDiQbpGkJvfebGmJDWE+rEXlqPSOXDoHNmE1/cRE=; b=f1ZrNnw//m6Ps9WfyZeGY9LsIv65AU/1aWIOeUqjCZyQGptomqbc4YbBnViGtmO0/0 o41xPM9kbzANW15ohhLgSXsglS0ynazY2jSc75Be5zJjMTM7ERhqEvG4pgJCzvDsCBQt 6JK+wQfi4/zB44ucDi8NQc7dHyg0zorzLsuVZWngOargyOiEyz1XBAoPRljNPklzaesz 8i+oEJv8lM4lybCKI0o7KsGjB2++tghVJgziB6y9k/WUb15IsujgZvcjJiY6gNMP30ht J3yDTrJxH8YYsT3cKW0QZ03jqGFgaBAwl5hrXdXokAuzgyJKfmtBHOt1nzU+bVg6eNoE V8FQ== X-Gm-Message-State: AE9vXwMhQgHtdSL8iKkZW6F5YbnIxSnH7Kn3bCGRBQdwjZNBI31VRiBvyGsL5vlSHxEx0w== X-Received: by 10.194.94.225 with SMTP id df1mr98740wjb.51.1473347194517; Thu, 08 Sep 2016 08:06:34 -0700 (PDT) Date: Thu, 8 Sep 2016 16:06:32 +0100 From: Stephane Chazelas To: Peter Stephenson , zsh-workers@zsh.org Subject: Re: [PATCH] Use == in expressions instead of the deprecated = Message-ID: <20160908150632.GA15106@chaz.gmail.com> Mail-Followup-To: Peter Stephenson , zsh-workers@zsh.org References: <20160905212754.24998-1-tgyurci@gmail.com> <20160908093516.4fc2dd1e@pwslap01u.europe.root.pri> <20160908121628.78977edd@pwslap01u.europe.root.pri> <20160908143128.GA14933@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160908143128.GA14933@chaz.gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) 2016-09-08 15:31:28 +0100, Stephane Chazelas: [...] > 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). [...] Appart from bash 2.02, I don't know of a shell implementation that treats [[ = ]] differently from [[ == ]] (or [ = ] vs [ == ] for those "[" implementations that support ==) however note that yash has a 3rd operator: [ === ] that is short for [ '<=' ] && [ '>=' ] or [ ! '<' ] && [ ! '>' ]. As in yash like in bash or ksh93 (but not zsh), < and > for string comparison use strcoll() (like sort/expr or awk's for strings) while == uses strcmp. And in some locales, there are strings that sort the same even though they are different. yash's === is a test to check that two strings sort the same, like the "=" operator of expr (or the == operator of some awk implementations as currently required by POSIX (though that's going to change)). For instance in a en_GB.UTF-8 locale on a GNU system, \u2461 sorts the same as \u2462 (in that case, a bug). expr $'\u2461' = $'\u2462' and yash -c '[ \u2461 === \u2462 ]' return true while [[ \u2461 < \u2462 ]] and [[ \u2461 > \u2462 ]] both return false in bash and ksh93. zsh's behaviour is more consistent here but means that for instance [[ Stéphane < Stuff ]] returns false (while bash and ksh93 return true) even though I'd exect é to sort before u. See also https://unix.stackexchange.com/questions/56655/what-is-the-difference-between-a-z-and-a-z/56674#56674 -- Stephane