bug-bash
[Top][All Lists]
Advanced

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

Re: set -e behaviour. Seems bug. Not the subshell issue!


From: Greg Wooledge
Subject: Re: set -e behaviour. Seems bug. Not the subshell issue!
Date: Tue, 11 Sep 2012 11:36:55 -0400
User-agent: Mutt/1.4.2.3i

On Tue, Sep 11, 2012 at 09:24:39PM +0600, ???????? ?????????????????? wrote:
> 1. Can you give me link (or name of) posix standard where I can read about
> this?

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25

  "When this option is on, if a simple command fails for any of the reasons
  listed in Consequences of Shell Errors or returns an exit status value >0,
  and is not part of the compound list following a while, until, or if keyword,
  and is not a part of an AND or OR list, and is not a pipeline preceded by the
  ! reserved word, then the shell shall immediately exit."

In your original example, which I believe looked something like:

  if ! myfunc; then

set -e is not in effect for two reasons: the if, and the !.  Either one
would be sufficient to disable it.  You've got both.

> 2. Is there any workaround (like shopt) that will help for such case? I
> have read all shopts, man bash and found nothing.

The workaround is "stop trying to use set -e".



reply via email to

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