I didn't understand clearly what you were expecting until I actually ran your example. I think this shows your expectations more clearly:
test a = a && { echo this line should be displayed test a = b && { echo this line should not be displayed and is not } # echo uncomment this line and the last echo will not display } || { echo this line should never be displayed but is } The "test a = b" evaluates to false, which makes the whole enclosure after "test a = a" also false, and now the last echo will display. The uncommented echo will make the middle clause true again, causing the last echo to not display (as expected). Peter Klaus Bartels <bart...@bartels.com> On 03/29/2018 01:22 AM, Klaus Bartels wrote: > If you execute the following script the result is wrong. It is self > explaining: > ------------------------------- > # > # GNU bash, version 4.4.12(1)-release (x86_64-slackware-linux-gnu) > # Linux ... 4.9.31 #1 SMP Wed Jun 7 14:57:36 CDT 2017 x86_64 Intel(R) > Core(TM) i5-7400 CPU @ 3.00GHz GenuineIntel GNU/Linux > # > test a = a && { > echo this line should be displayed > test a = b && { > echo this line should also not displayed, but creates the error > } > # echo uncomment this line and all works fine again > } || { > echo this line should never be displayed > } > # > ------------------------------ > If you uncomment the line in the middle, the script works correct. > I hope, it helps > > > > Mit freundlichen Gruessen / Best regards > Klaus Bartels > > ///---------------------------------------------------------/// > /// Bartels EDV (Bartels Consulting) /// > /// Klaus Bartels /// > /// Am Bullerbach 11 Phone +49-5484/93 91 0 /// > /// D-49536 Lienen FAX +49-5484/93 91 16 /// > /// Germany e-Mail bart...@bartels.com /// > ///---------------------------------------------------------/// >