zsh-workers
 help / color / mirror / code / Atom feed
* Function code breaking out of if then ...fi
@ 2012-11-02  9:09 Michal Maruska
  2012-11-02 21:39 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Maruska @ 2012-11-02  9:09 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

Hello,
I wonder if the following behaviour is a bug, or
simply my wrong expectation:

This script, assuming the globbing fails, and I'm not using NULL_GLOB,
does not bother finishing the commands in the "then ....fi" block,
instead continues after "fi".


#! /usr/bin/zsh -feu

fn () {
    foreach sum (non-existing*) {echo $sum}
}

if true;
then
    fn
    exit 0
fi

echo tragedy
exit -1


---------------------------

I was advised (on IRC) to use

{ fn } always { TRY_BLOCK_ERROR=0 }


But I'd like to see the behaviour documented in
the chapters not about " {} always {} ".
Thank you

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-11-12 10:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02  9:09 Function code breaking out of if then ...fi Michal Maruska
2012-11-02 21:39 ` Bart Schaefer
2012-11-05  8:22   ` Han Pingtian
2012-11-05  9:31     ` Han Pingtian
2012-11-05 14:29   ` Peter Stephenson
2012-11-05 14:55     ` Peter Stephenson
2012-11-05 16:08       ` Peter Stephenson
2012-11-06  6:47         ` Han Pingtian
2012-11-09 22:52       ` Peter Stephenson
2012-11-10  1:13         ` Bart Schaefer
2012-11-10 21:23           ` Peter Stephenson
2012-11-12 10:24             ` Peter Stephenson

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).