Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PRINT_EXIT_VALUE: Suppress for if/while conditions
- X-seq: zsh-workers 36234
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PRINT_EXIT_VALUE: Suppress for if/while conditions
- Date: Wed, 19 Aug 2015 02:06:49 +0200
- In-reply-to: <CAHYJk3TB=M=X2PSa2Jx0s2jwkVk9aCy8NqVarX8184HS0s4CFg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150731231225.GB2054@tarsus.local2> <20150815010451.GA16635@ioooi.vinc17.net> <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@xxxxxxxxxx> - 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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author