No subject
Mon Nov 10 21:43:42 UTC 2008
Exit status:
0 if the expression is neither null nor 0,
1 if the expression is null or 0,
expr should return 1 if the expression is '0'. coreutils thinks that
anything with a series of zeroes, even followed by leading dashes,
qualifies as '0' and thus returns 1 for all of these variants:
$ expr '0'
0
$ echo $?
1
$ expr '-0'
-0
$ echo $?
1
$ expr '00'
00
$ echo $?
1
$ expr '-00'
-00
$ echo $?
1
However, busybox only thinks that the literal '0' alone qualifies as 0:
$ ./busybox expr '0'
0
$ echo $?
1
and other variants don't qualify as '0', so it returns an exitcode of 0
rather than 1 (sorry if this is semi-confusing, but it's in the specs):
$ ./busybox expr '-0'
-0
$ echo $?
0
$ ./busybox expr '00'
00
$ echo $?
0
$ ./busybox expr '-00'
-00
$ echo $?
0
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
11-11-08 14:01 pgbovine New Issue
11-11-08 14:01 pgbovine Status new => assigned
11-11-08 14:01 pgbovine Assigned To => BusyBox
======================================================================
More information about the busybox-cvs
mailing list