zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: PRINT_EXIT_VALUE: Suppress for if/while conditions
Date: Wed, 19 Aug 2015 02:06:49 +0200	[thread overview]
Message-ID: <20150819000649.GA29640@zira.vinc17.org> (raw)
In-Reply-To: <CAHYJk3TB=M=X2PSa2Jx0s2jwkVk9aCy8NqVarX8184HS0s4CFg@mail.gmail.com>

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 <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


  reply	other threads:[~2015-08-19  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 23:12 Daniel Shahaf
2015-08-13  8:32 ` Peter Stephenson
2015-08-13 23:20   ` Daniel Shahaf
2015-08-14  8:19     ` Peter Stephenson
2015-08-17 22:00       ` Daniel Shahaf
2015-08-15  1:04 ` Vincent Lefevre
2015-08-15  1:20   ` Mikael Magnusson
2015-08-19  0:06     ` Vincent Lefevre [this message]
2015-08-19  0:25       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150819000649.GA29640@zira.vinc17.org \
    --to=vincent@vinc17.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).