From owner-freebsd-current Tue Feb 18 7:16: 3 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EB9337B401 for ; Tue, 18 Feb 2003 07:16:02 -0800 (PST) Received: from ece.cmu.edu (ECE.CMU.EDU [128.2.136.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96F9043F85 for ; Tue, 18 Feb 2003 07:16:01 -0800 (PST) (envelope-from allbery@ece.cmu.edu) Received: from [10.9.204.1] (allbery@allbery.dsl.telerama.com [205.201.8.182]) (authenticated) by ece.cmu.edu (8.11.0/8.10.2) with ESMTP id h1IFFhW04197; Tue, 18 Feb 2003 10:15:43 -0500 (EST) Subject: Re: Shell programming 101: Is this an expr(1) bug ? From: "Brandon S. Allbery " KF8NH To: Poul-Henning Kamp Cc: current@FreeBSD.ORG In-Reply-To: <57374.1045568362@critter.freebsd.dk> References: <57374.1045568362@critter.freebsd.dk> Content-Type: text/plain Organization: Message-Id: <1045581342.65526.2.camel@rushlight.kf8nh.apk.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 18 Feb 2003 10:15:42 -0500 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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