DragonFly BSD
DragonFly users List (threaded) for 2006-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: /bin/sh compatibility issue

From: "Steve O'Hara-Smith" <steve@xxxxxxxxxx>
Date: Wed, 10 May 2006 17:59:05 +0100

On Wed, 10 May 2006 17:49:38 +0200
joerg@xxxxxxxxxxxxxxxxx wrote:

> 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.

-e errexit
  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.

set -e
if true; then
   false && echo "huh?"   # This shouldn't exit because false is LHS of &&
echo "false1"
false   # This should exit because false is not explicitly tested
echo "false2"

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
                                            |    http://www.sohara.org/

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