DragonFly users List (threaded) for 2006-05
Re: /bin/sh compatibility issue
On Wed, 10 May 2006 17:49:38 +0200
> On Wed, May 10, 2006 at 03:39:53PM +0000, Johannes Hofmann wrote:
> > The following shell script outputs "false1" with all shells I tried
> > but with /bin/sh on DragonFly. Is this a known incompatibility?
> I have to read the POSIX definitions, but this doesn't look very wrong
> at least. Actually, I can understand this behaviour at the very least.
It doesn't seem to be consistent with the description of -e
in the sh manpage.
Exit immediately if any untested command fails in non-interactive mode.
The exit status of a command is considered to be explicitly 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.
I've quoted the script with added comments.
if true; then
false && echo "huh?" # This shouldn't exit because false is LHS of &&
false # This should exit because false is not explicitly tested
C:>WIN | Directable Mirror Arrays
The computer obeys and wins. | A better way to focus the sun
You lose and Bill collects. | licences available see