[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error handling question
From: |
Marc Herbert |
Subject: |
Re: Error handling question |
Date: |
Mon, 09 Nov 2009 18:31:45 +0000 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Greg Wooledge a écrit :
> The problem being "how to use set -e in a consistent manner across all
> shells"? You can't. set -e is unpredictable, unreliable, and should be
> shunned. As you can see by the last dozen or so message on this mailing
> list, not even bash gurus (other than Chet) can figure out its semantics.
>
The fact that "set -e" is not the default looks like a big design
mistake to me. I cannot understand how ignoring errors in a program and
going on like nothing happened is a desirable thing. When I write a
succession of commands in a script, a later command depends on the
success of earlier commands more often than not and there is no point
going on with the rest of script. Ignoring errors should be the
exception and not the rule. The same can probably be said for C.
> Check for errors yourself on the commands that matter. That way you'll
> know what will cause termination and what won't. Yes, I know, it means
> your script is longer. But longer is better than unpredictable.
ALL my commands matter so I practically cannot check the return status
of everyone of them. Instead I use "set -e" systematically. It
works. It is unpredictable but I do not to care: a safety net with a few
holes is way better than none at all. The very few times I actually want
to ignore an error I just append " || true" to the corresponding
command.
- Re: Error handling question, (continued)
- Re: Error handling question, Chet Ramey, 2009/11/09
- Re: Error handling question, Chet Ramey, 2009/11/09
- Message not available
- Re: Error handling question, Jan Schampera, 2009/11/09
- Re: Error handling question, Ciprian Dorin, Craciun, 2009/11/09
- Re: Error handling question, Greg Wooledge, 2009/11/09
- Re: Error handling question, Ciprian Dorin, Craciun, 2009/11/09
- Re: Error handling question, Greg Wooledge, 2009/11/09
- Re: Error handling question, Sven Mascheck, 2009/11/09
- Re: Error handling question, Chet Ramey, 2009/11/09
- Re: Error handling question, Sven Mascheck, 2009/11/09
- Re: Error handling question,
Marc Herbert <=
- Re: Error handling question, Chris F.A. Johnson, 2009/11/09
- Re: Error handling question, Marc Herbert, 2009/11/10
- Re: Error handling question, Marc Herbert, 2009/11/10
- Re: Error handling question, Chet Ramey, 2009/11/09
- Re: Error handling question, Marc Herbert, 2009/11/10
- Re: Error handling question, Chet Ramey, 2009/11/10