From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24857 invoked by alias); 21 Jan 2016 13:06:50 -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: 37717 Received: (qmail 13326 invoked from network); 21 Jan 2016 13:06:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Message-ID: <56A0D7DE.5000407@inlv.org> Date: Thu, 21 Jan 2016 14:06:38 +0100 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org CC: Peter Stephenson Subject: [BUG] 'test' returns 1 (not >1) on error [was: test is not posix] References: <20160120220614.18fe6683@enterprise> <56A01C67.1050509@inlv.org> <20160121124113.12e2d72a@pwslap01u.europe.root.pri> In-Reply-To: <20160121124113.12e2d72a@pwslap01u.europe.root.pri> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Peter Stephenson schreef op 21-01-16 om 13:41: > Yes, we now have tests for the following cases. It's trivial to add more > if you can think of any that might be problematic. Something I also noticed back in May, and which I'm now reminded of, is that test/[ returns status 1, and not 2 or higher, if an error occurs. $ [ x = a b ] [: too many arguments $ echo $? 1 $ [ 1 -eq ] zsh: parse error: condition expected: 1 $ echo $? 1 This makes it impossible to test for the failure of test/[ using the exit status. POSIX says the status should be 2 or higher on error: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_14 Thanks, - Martijn