bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: more complete set -e


From: Marc Weber
Subject: Re: feature request: more complete set -e
Date: Mon, 29 Jun 2009 00:45:29 +0200
User-agent: Mutt/1.5.16 (2007-06-09)

On Thu, Jun 25, 2009 at 07:33:18PM -0400, Chet Ramey wrote:
> Marc Weber wrote:
> 
> > This is my point: I'd like to tell bash: Whenever running an executable
> > assume that if it returns a non zero exit status that's a unforeseen
> > exception. And in this case don't continue as usual but abort and return
> > non zero exit status yourself. set -e comes close.
> 
> You're talking about making bash exit when a command fails even when
> not in a command execution context.  The example above is a word
> expansion context.  `set -e' acts in a command execution context.
> 
> Nor are you talking only about executables; you mean builtins too,
> just to make that clear.
> 
> Your proposal would have bash exit on
> 
> echo `expr $var - 1`
shrug. I didn't knew that either.
I think that this is bad. expr should do some calculation. If the
calculation fails (eg devision by zero) the return value should be non
zero.

But yeah. You've just given me another example why you need deep active
knowledge to write good scripts

Maybe I should rather just use perl, python, ruby or php instead of
continuing this thread then

Marc Weber




reply via email to

[Prev in Thread] Current Thread [Next in Thread]