Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Function code breaking out of if then ...fi
- X-seq: zsh-workers 30774
- From: Michal Maruska <mmaruska@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Function code breaking out of if then ...fi
- Date: Fri, 2 Nov 2012 10:09:09 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=z2/5dYwfBWRjfV+ygix5nt9SEJSLzIasETmXV5UuP7w=; b=bQXrfPJvFbd//IEub73EdIs8rjPsW8DqkZZ9mvbjbN+CRf7Br22fL+MobMxF1DSLJL UGL/3InpNcLASvdIG++B901e4hLsVvI/RyOUZnl2qQcL3mjDy3C5Q9vQ3xSYfc1JSl+J tYhAfxW++OtMp2a4nLcjeXPyuk5oyzOZnvum5JZvIC1qtDR2mz0o+tGDd/xEnrAIxKVx 9LStYm1bL02tQyz/JdyI8r91Ax6CD7qSfnKvymeOdn+OpTS9xDEIc13ATKw2ouLaUYVV 2pdRimPITRLe4j4VZU9u9uFJ+cmRsOfCl5liX0i3h2nvcWy+q8v/K4Nhlu+babVfY6+R hS1Q==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author