Skip site navigation (1)Skip section navigation (2)
Date:      18 Feb 2003 10:15:42 -0500
From:      "Brandon S. Allbery " KF8NH <allbery@ece.cmu.edu>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        current@FreeBSD.ORG
Subject:   Re: Shell programming 101:  Is this an expr(1) bug ?
Message-ID:  <1045581342.65526.2.camel@rushlight.kf8nh.apk.net>
In-Reply-To: <57374.1045568362@critter.freebsd.dk>
References:  <57374.1045568362@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2003-02-18 at 06:39, Poul-Henning Kamp wrote:
> 	+ expr ad0 : ^ad\([0-9]\)$
> 	+ a0=0
> 	syv# echo $?
> 	1
> 	syv# 
> 
> That looks like a bug to me...

hilfy:202 Z$ /bin/expr ad0 : '^ad\([0-9]\)$'
0
zsh: exit 1     /bin/expr ad0 : '^ad\([0-9]\)$'

(Solaris 8 box)

The Solaris manpage claims:

EXIT STATUS
     As a side effect of expression evaluation, expr returns  the
     following exit values:
(...)
     1     if the expression is either NULL or 0

So it looks like correct behavior, if slightly odd in this particular
context.

-- 
brandon s allbery [openafs/solaris/japh/freebsd] allbery@kf8nh.apk.net
system administrator [linux/heimdal/too many hats] allbery@ece.cmu.edu
electrical and computer engineering                              KF8NH
carnegie mellon university  [better check the oblivious first -ke6sls]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1045581342.65526.2.camel>