From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18452 invoked by alias); 19 Aug 2015 00:06:55 -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: 36234 Received: (qmail 952 invoked from network); 19 Aug 2015 00:06:53 -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=-0.3 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.0 Date: Wed, 19 Aug 2015 02:06:49 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: PRINT_EXIT_VALUE: Suppress for if/while conditions Message-ID: <20150819000649.GA29640@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20150731231225.GB2054@tarsus.local2> <20150815010451.GA16635@ioooi.vinc17.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6477-vl-r81226 (2015-08-07) On 2015-08-15 03:20:35 +0200, Mikael Magnusson wrote: > Seeing the exit value of each zgrep invocation seems to be within the > scope of the option. If you find it annoying, maybe you shouldn't have > it set? I have it set because I like it for individual commands. > For example if you did > > for i in file1 file2; do > veryimportanttask $i > done > > you would surely want to see if any of the invocations failed. But you don't know which one: $ for i in 1 2; do /bin/false $i; done zsh: exit 1 /bin/false $i zsh: exit 1 /bin/false $i One could write veryimportanttask $i || echo error for $i in such a case, which is more informative. With my example above, without PRINT_EXIT_VALUE: $ for i in 1 2; do /bin/false $i || echo error for $i; done error for 1 error for 2 -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)