Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2003 12:39:22 +0100
From:      Poul-Henning Kamp <phk@phk.freebsd.dk>
To:        current@freebsd.org
Subject:   Shell programming 101:  Is this an expr(1) bug ?
Message-ID:  <57374.1045568362@critter.freebsd.dk>

next in thread | raw e-mail | index | archive | help


Running:

	#!/bin/sh
	set -ex

	for p in ad2 ad0 ad1
	do
		a0=`expr $p : '^ad\([0-9]\)$'`
	done

I get:

	syv# sh _
	+ expr ad2 : ^ad\([0-9]\)$
	+ a0=2
	+ expr ad0 : ^ad\([0-9]\)$
	+ a0=0
	syv# echo $?
	1
	syv# 

That looks like a bug to me...

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

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?57374.1045568362>