Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PRINT_EXIT_VALUE: Suppress for if/while conditions



On Sat, Aug 15, 2015 at 3:04 AM, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> On 2015-07-31 23:12:25 +0000, Daniel Shahaf wrote:
>> I'd like to disable the effect of PRINT_EXIT_VALUE while evaluating
>> if/while conditions, since it's uninformative (conditions sometimes
>> fail, that's their sine qua non) and annoying (when doing a for/if
>> interactively and the 'if' condition is false in many iterations, the
>> option must be disabled to prevent stderr spamming).
>
> It's also annoying in loops, e.g.
>
>   for i in **/*.gz; zgrep foo $i

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?

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. I could
see the value in making it shut up if you changed the body to


for i in file{1..9999}; do
  notsoimportanttask $i || :
done

but that doesn't currently help.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author