On Sat, Jul 26, 2025 at 21:32:08 +0200, Farblos wrote: > not sure whether I'm seeing pink elephants here, or whether this is > already documented somewhere in the autoconf manual. > > TL;DR I have on Solaris 10: > > # "echo foo" not executed in case of failure?! > $ cd /foo || echo foo > /foo: does not exist
I doubt `||` is misbehaving here. Did you try echoing `$?` after a failed `cd`? I suspect it may be reporting an exit code of `0` and therefore not running `echo foo` makes sense (from the pipeline PoV; `cd` is still buggy). > $ if cd /foo; then echo yes; else echo no; fi # tri-state boolean? > + cd /foo > /foo: does not exist But this is quite odd. Maybe there's *no* exit code for `cd`? > $ ( cd /foo ) || echo foo # wrapping into subshell > + cd /foo # helps, so exitval should > /foo: does not exist # be OK > + echo foo > foo > > Solaris 11 (tested on i86pc, not SPARC, though) behaves as expected > with respect to this. > > What do you think about that one? Is there anybody able to > reproduce this? What version of `/bin/sh` is in use (though I suppose being a more "classic" Unix, it comes as part of the base system)? --Ben