In sh(1), about '-e' and 'errexit' is follows description. -e errexit Exit immediately if any untested command fails in non-interactive mode. The exit status of a command is considered to be explicit- ly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an ``&&'' or ``||'' operator. But in 'if' statement, if a left command of '&&' failes then exit immediately. This behavior is found doing follows command. And this is found only in FreeBSD and NetBSD. $ sh -ecx 'if true; then false && true; fi; true' + true + false $ In bash-2.05, $ bash -ecx 'if true; then false && true; fi; true' + true + false + true $ In SunOS 5.7's /bin/sh $ /bin/sh -ecx 'if true; then false && true; fi; true' + true + false + true In SunOS 5.7's /bin/ksh $ /bin/ksh -ecx 'if true; then false && true; fi; true' + true + false + true $ How-To-Repeat: Do follow command, please. We expect last 'true', but isn't appeared. $ sh -ecx 'if true; then false && true; fi; true' + true + false $
Responsible Changed From-To: freebsd-bugs->chaucer Martin has an interest in sh.
Responsible Changed From-To: chaucer->cracauer Spell Martin's name correctly... Martin - this PR contains a sh patch and ex http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28852
State Changed From-To: open->closed Fixed in the HEAD.