Johan Hovold wrote:
> Hi, 
> 
> Is the following behaviour intended or a bug in bash (3.1.17(1)-release)? The 
> command list 
> 
>   (set -e; false; echo hello)
> 
> does not print hello and has non-zero exit status. All fine. If I try to use 
> this fact to display an error message the semantics changes. The following 
> command
> 
>   (set -e; false; echo hello) || echo fail
> 
> _does_ print hello _rather_ than fail. Why is this? One could argue that the 
> first echo command is now part of an OR-list, but this on the parent-shell 
> level (where set -e has no other effects) and via the command list, and not 
> in the subshell.
> 
> A corresponding change occurs if the command list is part of an AND-list.

The subshell inherits the knowledge it's part of an AND or OR list.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to