bug-bash
[Top][All Lists]
Advanced

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

Re: Change in behaviour regarding subshell handling?


From: Chet Ramey
Subject: Re: Change in behaviour regarding subshell handling?
Date: Thu, 24 Sep 2009 09:33:54 -0400

> Thanks for the confirmation.  Maybe CHANGES can be updated to list all
> the changes that were made as a consequence of the Austin Group's
> interpretation.

Here's the new description of "set -e":

   -e When this option is on, when any command fails (for any of the
      reasons listed in [xref to 2.8.1] or by returning an exit status
      greater than zero) the shell immediately shall exit with the
      following exceptions:

      1) The failure of any individual command in a multi-command
          pipeline shall not cause the shell to exit. Only the
          failure of the pipeline itself shall be considered.

      2) The -e setting shall be ignored when executing the compound
          list following the while, until, if, or elif reserved word,
          a pipeline beginning with the ! reserved word, or any
          command of an AND-OR list other than the last.

      3) If the exit status of a compound command other than a
          subshell command was the result of a failure while -e was
          being ignored, then -e shall not apply to this command.

      This requirement applies to the shell environment and each
      subshell environment separately. For example, in

          set -e; (false; echo one) | cat; echo two

      the false command causes the subshell to exit without executing
      echo one; however, echo two is executed because the exit status
      of the pipeline (false; echo one) | cat is zero.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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