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

Re: PRINT_EXIT_VALUE problems



Sorry for forgetting to redirect my own last reply to zsh-workers even
though I meant to.  I'm keeping this one on -users on purpose, because
it's no longer about code details.

On Dec 24, 12:13pm, Vincent Lefevre wrote:
}
} xvii% setopt PRINT_EXIT_VALUE
} xvii% false || true
} zsh: exit 1
} 
} 1. I don't think the value should be printed in the case of a program
} before ||, because the goal of || is to ignore or handle the error.

I've been thinking about this a bit more.

Consider the case of a pipeline -- here's a silly example:

torch% return 3 | return 2 | return 1 | true
zsh: exit 3     return 3 | 
zsh: exit 2     return 2 | 
zsh: exit 1     return 1
torch% 

Now consider:

torch% return 3 | return 2 | return 1 || true

If we followed your suggestion above, we should suppress printing the
exit values of every stage of the pipeline.  Is that really desirable?

What about

torch% { (return 3); (return 2); return 1 } || true

Which exit values should be printed there?



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