bug-bash
[Top][All Lists]
Advanced

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

set -e and OR-lists


From: Johan Hovold
Subject: set -e and OR-lists
Date: Thu, 22 Feb 2007 14:45:31 +0100

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.

Please CC this address since I'm not on the list. 

Thanks,

Johan Hovold





reply via email to

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