Re: sh-utils expr 1.15 regexp bug

Mark Orr (
Wed, 12 Feb 1997 05:13:49 -0600

Noah Friedman wrote:
> It used to be the case that the expression
> expr 100 : '0$\|-?[1-9][0-9]*'
> Would print 3. This worked with sh-utils 1.12.
> With 1.15, it prints 0 unless I remove "-?" from the regexp, or replace it
> with `*', which isn't exactly right.
> Isn't `?' a part of the old grep syntax for matching the preceding
> character or group 0 or 1 times? Was this functionality removed
> deliberately? It's breaking the linux kernel configuration scripts.

I've experienced this too...It affects two lines in Menuconfig only.
reply given me by the maintainer of sh-utils was to add a "\" before
the ? as suggested in the other reply to your post.

There are two such functions in Menuconfig -- one to accept decimal
values, and one to accept hexadecimal values. Also look at a line 30
or so lines beyond that one that reads:

if expr $answer : '[0-9a-fA-F]+$' >/dev/null

add a "\" before the plus sign ("+") to this one.

This affects the Menuconfig in all linux kernel version so far.

I've sent mail to the linux-kernel mailing list...but it went unnoticed

Mark Orr